A full-featured Customer Relationship Management system built with Django, MySQL, and Django REST Framework. Provides both a web interface and a RESTful API for managing customer records with authentication, search, pagination, and CRUD operations.
Live Demo: web-production-8332.up.railway.app
- Authentication — Registration, login, logout with Django's auth system
- CRUD Operations — Create, read, update, and delete customer records
- Search & Filter — Search records by name, email, phone, or city
- Pagination — Server-side pagination for efficient data browsing
- REST API — Full CRUD API powered by Django REST Framework
- Admin Dashboard — Customized Django admin with filters and search
- Responsive UI — Bootstrap 5 for mobile-friendly design
- Security — CSRF protection, POST-only deletes, env-based secrets, production hardening
- Docker Support — Containerized with Docker Compose (Django + MySQL)
- CI/CD — Automated testing via GitHub Actions
| Layer | Technology |
|---|---|
| Backend | Python 3.12, Django 5.2 |
| API | Django REST Framework 3.15 |
| Database | MySQL 8.0 |
| Frontend | Django Templates, Bootstrap 5 |
| DevOps | Docker, Docker Compose, GitHub Actions |
| Server | Gunicorn (production) |
Django-CRM/
├── dcrm/ # Project configuration
│ ├── settings/
│ │ ├── base.py # Shared settings
│ │ ├── dev.py # Development overrides
│ │ └── prod.py # Production (HTTPS, HSTS, etc.)
│ ├── urls.py
│ └── wsgi.py
├── website/ # Main application
│ ├── models.py # Record model with validators
│ ├── views.py # Web views with auth decorators
│ ├── forms.py # SignUp + AddRecord forms
│ ├── serializers.py # DRF serializers
│ ├── api_views.py # DRF viewsets
│ ├── api_urls.py # API router
│ ├── admin.py # Customized admin
│ ├── tests.py # 20+ unit & integration tests
│ └── templates/website/ # Namespaced templates
├── .env.example # Environment template
├── .github/workflows/ci.yml # GitHub Actions pipeline
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── manage.py
- Python 3.10+
- MySQL 8.0+
- pip
git clone https://github.com/ChakerChourouk/Django-CRM.git
cd Django-CRM
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtcp .env.example .env
# Edit .env with your database credentials and secret keyCREATE DATABASE elderco CHARACTER SET utf8mb4;python manage.py migrate
python manage.py createsuperuser
python manage.py runserverOpen http://127.0.0.1:8000/ in your browser.
# Copy and configure environment
cp .env.example .env
# Build and start containers
docker compose up --build -d
# Run migrations inside container
docker compose exec web python manage.py migrate
docker compose exec web python manage.py createsuperuserApp available at http://localhost:8000/
All endpoints require authentication (session-based).
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/records/ |
List all records |
POST |
/api/records/ |
Create a record |
GET |
/api/records/{id}/ |
Retrieve a record |
PUT |
/api/records/{id}/ |
Update a record |
PATCH |
/api/records/{id}/ |
Partial update |
DELETE |
/api/records/{id}/ |
Delete a record |
curl -X POST http://localhost:8000/api/records/ \
-H "Content-Type: application/json" \
-b "sessionid=<your-session-id>" \
-d '{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"phone": "+11234567890",
"address": "456 Oak Ave",
"city": "Portland",
"state": "OR",
"zipcode": "97201"
}'python manage.py test website --verbosity=2Tests cover:
- Model creation and validation
- Authentication (login, logout, registration)
- CRUD views (create, read, update, delete)
- Search and pagination
- REST API endpoints
- Permission enforcement
This app is deployed on Railway with PostgreSQL.
Live URL: web-production-8332.up.railway.app
To deploy your own instance:
- Fork this repo
- Create a new project on Railway and connect your GitHub repo
- Add a PostgreSQL database to the project
- Set environment variables:
Variable Value DJANGO_SETTINGS_MODULEdcrm.settings.prodSECRET_KEY(generate a random key) ALLOWED_HOSTS.railway.appDATABASE_URL${{Postgres.DATABASE_URL}} - Railway auto-deploys on every push. Migrations run automatically via the
releasecommand in the Procfile. - Create a superuser via the Railway Shell tab:
python manage.py createsuperuser
This project is open source and available under the MIT License.

