A robust and scalable Customer Relationship Management (CRM) system built using Golang. This system is specifically designed for educational institutions to manage courses, teachers, students, groups, and timetables efficiently.
git clone https://github.com/tamimorif/CRM-Service.git
cd CRM-Service
cp .env.example .env
# Edit .env with your configuration
make deps
docker-compose up -d
Or run locally:
make run
The API will be available at http://localhost:8080
See API.md for comprehensive API documentation including:
Get all teachers with pagination:
curl -H "X-Auth-Token: your_token" \
"http://localhost:8080/teachers?page=1&page_size=10&search=john"
Create a new course:
curl -X POST -H "X-Auth-Token: your_token" \
-H "Content-Type: application/json" \
-d '{"title":"Web Development","monthly_fee":1000,"duration":6}' \
http://localhost:8080/courses
Health check:
curl http://localhost:8080/health
.
├── cmd/
│ ├── api/ # Main API application
│ └── console/ # Console utilities
├── pkg/
│ ├── auth/ # gRPC auth client (generated)
│ ├── config/ # Application configuration
│ ├── database/ # Database configuration
│ ├── dto/ # Data Transfer Objects
│ ├── errors/ # Custom error definitions
│ ├── handlers/ # HTTP request handlers
│ ├── helpers/ # HTTP response helpers & utilities
│ ├── logger/ # Logging configuration
│ ├── middlewares/ # Auth & logging middleware
│ ├── models/ # Database models
│ ├── repository/ # Data access layer
│ └── services/ # Business logic layer
├── tests/ # Integration and unit tests
├── .env.example # Environment variables template
├── docker-compose.yml
├── Dockerfile
├── Makefile # Build & development commands
├── API.md # API documentation
└── README.md
make help # Show all available commands
make build # Build the application
make run # Run the application
make dev # Run with hot reload (requires air)
make test # Run tests
make test-coverage # Run tests with coverage report
make docker-up # Start Docker containers
make docker-down # Stop Docker containers
make docker-logs # Show Docker logs
make lint # Run linter
make fmt # Format code
make test
make fmt
make lint
Create a .env file based on .env.example:
# Database
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=crm_service
DB_PORT=5432
# Application
APP_PORT=8080
# Auth Service
AUTH_SERVICE_ADDR=localhost:50051
# Development
SKIP_AUTH=false
The project includes a complete Docker setup:
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f crm-service
# Stop services
docker-compose down
Services included:
CRM goes live from the main branch. HTTPS and routing are handled by the
single shared nginx reverse proxy in Github/proxy/ (one per server, not per
project), which terminates TLS with a Cloudflare Origin certificate and serves
CRM at crm.tamimarif.com.
Bring CRM up from main:
./run.sh # checks out main, pulls, ensures the edge-proxy network, and starts the stack
crm-service joins the external edge-proxy docker network so the shared
proxy reaches it by name; it publishes no host port (traffic arrives via
the proxy).cd ../proxy && docker compose up -d.Github/DEPLOYING-BEHIND-NGINX.md and Github/ADD-NEW-PROJECT.md.All list endpoints support pagination:
GET /teachers?page=1&page_size=10
Search across multiple fields:
GET /teachers?search=john
GET /courses?search=web
Sort by any field:
GET /teachers?sort=name&order=asc
GET /courses?sort=created_at&order=desc
Related data is automatically loaded for single-item GET requests and can be included in list requests.
Contributions are welcome! Please follow these steps:
git checkout -b feature/amazing-feature
git commit -m "Add amazing feature"
git push origin feature/amazing-feature
make fmt and make lint before committingThe application provides three health check endpoints:
These endpoints are publicly accessible (no authentication required).
This project is licensed under the MIT License. See the LICENSE file for details.
Author: Tamim Orif
GitHub: @tamimorif
Project: CRM-Service
For questions, issues, or collaboration opportunities, feel free to open an issue or reach out!