# README
CPEEVO Backend
This project is the backend for the CPEEVO application, built using the Gin framework and MongoDB. It provides various APIs for managing events, users, posts, and authentication.
Project Structure
.
├── .air.toml
├── .dockerignore
├── .env
├── .env.template
├── .github/
│ └── workflows/
│ └── go.yml
├── .gitignore
├── .vscode/
├── docker-compose.yml
├── Dockerfile
├── go.mod
├── go.sum
├── kubernetes/
│ ├── configmap.yaml
│ ├── deployment.yaml
│ ├── secret.yaml
│ ├── secret.yaml.template
│ └── service.yaml
├── main.go
├── README.md
└── src/
├── controllers/
│ ├── accountController.go
│ ├── eventController.go
│ ├── postController.go
│ └── userController.go
├── database/
│ └── db.go
├── helpers/
│ └── tokenHelper.go
├── middleware/
│ └── authMiddleware.go
├── models/
│ ├── auth.go
│ └── event.go
│ └── post.go
└── routes/
└── route.go
Getting Started
Prerequisites
- Go 1.23 or later
- Docker
- Kubernetes
- MongoDB
Setup
-
Clone the repository:
git clone https://github.com/yourusername/cpeevent-backend.git cd cpeevent-backend
-
Create the .env file:
Copy the .env.template file to .env and fill in your MongoDB connection details.
cp .env.template .env
-
Install dependencies:
go mod download
Running the Application
Using Docker
-
Build and run the Docker container:
docker-compose up --build
-
Access the application:
Open your browser and go to
http://localhost:8080
Using Kubernetes
Example configuration is for deploying with Oracle Kubernetes Engine.
-
Apply Kubernetes configurations:
kubectl apply -f kubernetes/configmap.yaml kubectl apply -f kubernetes/secret.yaml kubectl apply -f kubernetes/deployment.yaml kubectl apply -f kubernetes/service.yaml
-
Access the application:
Open your browser and go to the external IP provided by the Kubernetes service.
Running Locally
-
Run the application:
go run main.go
-
Access the application:
Open your browser and go to
http://localhost:8080
Environment Variables
MONGO_URI
- MongoDB connection stringDATABASE_NAME
- Name of the MongoDB databaseSECRET_KEY
- Secret key for JWTGIN_MODE
- Gin mode (release
ordebug
)ORIGIN_URL
- Allowed origin URL for CORS
License
This project is licensed under the MIT License. See the LICENSE file for details.