🏢 team_pro_app: Enterprise Multi-Tenant SaaS Platform
team_pro_app is an enterprise-grade, multi-tenant Software as a Service (SaaS) platform built using the robust Django framework. It is engineered to provide secure and isolated environments for multiple client organizations, utilizing a unique subdomain for each tenant (e.g., client-a.yourdomain.com). This core architecture ensures strict data segregation, consistent session management, and custom branding across the client base.
A professional multi-tenant project management web application built with Django, Django REST Framework, TailwindCSS, and Alpine.js.
This project was developed as part of a technical assessment focusing on:
- ✅ Multi-tenant architecture (middleware-driven)
- ✅ Production-ready deployment
- ✅ Clean code & maintainable structure
- ✅ Authentication & isolated organization spaces
- ✅ Developer-friendly documentation & API tools
| Resource | Link |
|---|---|
| ✅ Production URL | https://www.teampro.sparkweb.tech/ |
| 🎥 Demo Video | https://res.cloudinary.com/dsh616xsc/video/upload/v1762180347/03.11.2025_15_14_tef0nr.webm |
| 🧠 GitHub Repository | https://github.com/Samy440/team_pro_app.git |
Note:
Cloudflare returned an intermittentError 1000: DNS points to prohibited IPduring deployment.
The application still works fine locally and in production once DNS propagation completes.
TeamPro is a multi-tenant management application where organizations can:
- Create and manage their workspace
- Add projects & tasks
- add and manage team members
- Switch organization access without logging out
- Enjoy full data isolation between tenants
Inspired by systems like GitHub Organizations, TeamPro ensures:
- Data isolation per company
- Users can belong to multiple orgs
- Tenant context resolution via middleware (not libraries)
- No Django-Tenants → full control & flexibility
I deliberately avoided libraries like
django-tenantsto build multi-tenancy from scratch, ensuring full understanding, flexibility, and fewer migration constraints.
The application is deployed on Render Cloud. Accessing the live link currently returns a Cloudflare Error 1000 (DNS points to prohibited IP).
This is a common infrastructure issue related to the DNS proxy settings between Cloudflare (if used) and the Render environment, not a code defect. The application is fully functional locally.
Instead of relying on heavy-duty external libraries like django-tenants, this project implements a Custom Middleware-Based Multi-Tenancy strategy.
| Feature | Implementation | Benefit |
|---|---|---|
| Data Isolation | Achieved via a single database schema, with every data model (e.g., Projects, Tasks, Users) linked to a Company (Tenant) via a Foreign Key. |
Highly flexible query customization and simplified database management compared to schema-per-tenant. |
| Session Isolation | Subdomain Routing (client-a.yourdomain.com). This ensures that user sessions and cookies are correctly scoped to the specific organization. |
Mimics real-world SaaS architecture and provides clear visual and technical separation. |
| Domain Redirection | Implemented directly in the Dashboard view (and/or custom middleware) to automatically redirect users accessing the generic root domain (yourdomain.com) to their active organization's subdomain. |
Prevents users from navigating outside their secure environment. |
| Seamless Switching | Allows authenticated users belonging to multiple organizations to switch instantly via a dynamic front-end mechanism (using iframes and postMessage for secure, cross-domain token transfer). |
Excellent User Experience (UX) without requiring logouts/logins. |
| Category | Technology | Justification |
|---|---|---|
| Backend Core | Python, Django | As a backend developer specialized in Python/Django and FastAPI, Django is the "Swiss Army knife" of choice. It offers all necessary components—ORM, built-in security, routing, and a powerful Admin—for rapid, secure, and maintainable application development. |
| API | Django Rest Framework (DRF) | The industry standard for creating RESTful APIs in Django. Its use of Serializers ensures strong data validation, clear data contracts, and seamless integration with authentication mechanisms. |
| Authentication | Django Auth Token | Provides secure, token-based authentication for the API layer, which is crucial for modern single-page application (SPA) style communication. |
| API Documentation | DRF Spectacular, Swagger UI | Essential for professional delivery. DRF Spectacular automates the generation of an OpenAPI specification (Swagger) directly from the DRF code, providing a self-documenting and interactive API reference. |
| Database | PostgreSQL | Chosen for its reliability, transactional integrity, and advanced features (e.g., JSON fields, indexing capabilities) required for a production-level, multi-tenant application. |
| File Storage | Cloudinary | Used for managing static and media files (like organization logos or user avatars). It offloads asset management, ensuring faster content delivery (CDN) and simplified deployment. |
| Frontend | HTML, CSS, JavaScript, Tailwind CSS (CDN), Alpine.js | A conscious choice to keep the frontend simple and fast. Tailwind CSS (CDN) accelerates styling without complex build tools, and Alpine.js provides declarative, minimal JavaScript reactivity, allowing full focus on the critical backend architecture and security. |
Django remains my favorite backend framework — security, speed, ORM power, admin panel, scalability.
| Tool | Purpose |
|---|---|
| Django Spectacular | API documentation engine |
| Swagger UI | Interactive API docs + testing |
Instead of using django-tenants, I implemented a custom middleware strategy:
- Detect tenant based on sub-domain or session context
- Filter database queries to isolate organization data
- Allow cross-org user membership like GitHub
- Personalizable & flexible without external constraints
git clone https://github.com/Samy440/team_pro_app.git
cd team_pro_app
2️⃣ Create Virtual Env & Install Dependencies
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
3️⃣ Create .env
Create a `.env` file in the root directory with the following variables:
```env
SECRET_KEY='your-secret-key'
DEBUG=False
# Cloudinary Credentials
CLOUD_NAME='your-cloudinary-cloud-name'
API_KEY='your-cloudinary-api-key'
API_SECRET='your-cloudinary-api-secret'
use Aiven PostgreSQL credentials for quick setup:
DATABASE_HOST=''
DATABASE_USER=''
DATABASE_PASSWORD=''
DATABASE_NAME=''
DB_PORT=''
PYTHON_VERSION=3.11.2
DJANGO_VERSION=5.2
4️⃣ Run Migrations & Start Server
python manage.py migrate
python manage.py runserver