Skip to content

Commit 313d988

Browse files
authored
Dev (#565)
* Remove root.html template and associated styles/scripts * refactor: remove unused backend scripts and team-related files - Deleted entrypoint.sh and wait-for-postgres.sh as they are no longer needed. - Removed gunicorn.sh and migrate.sh scripts to streamline deployment. - Cleaned up teams app by deleting models, serializers, views, migrations, and URLs related to teams. - Added new board detail page and task management functionality in the frontend. * Refactor newsletter management: remove newsletter.js, update email and phone fields in contacts and leads, enhance form handling, and clean up unsubscribe functionality. * Add environment variables, implement theme management, and update cookie settings for JWT * Refactor project references from 'opensource-startup-crm' to 'Django-CRM' across the frontend codebase, updating links, images, and text to reflect the new repository name. Removed unnecessary animations and improved code readability in the login page. * feat: Implement multi-tenancy * feat: Add enterprise documentation and AI-related markdown files, alongside minor code refactoring and import cleanup. * feat: Enable row-level security (RLS) for multi-tenancy across all applications. * chore: Remove numerous frontend site pages and server-side scripts, add `.mcp.json` and `TODO.md`, and update documentation. * app folder removed * auth fix * api url fix * type fix * chore: Add project TODO list and mcpServers configuration, and fix RLS middleware to skip unresolved URLs. * feat: Rebrand project to BottleCRM, update README with new SvelteKit/Django REST architecture, and enhance RLS context middleware. * feat: Add shadcn-svelte mcp config and project TODO list, and enhance Django cookie security settings. * .
1 parent fc05248 commit 313d988

4 files changed

Lines changed: 215 additions & 138 deletions

File tree

README.md

Lines changed: 186 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,237 @@
1-
# Django-CRM
2-
3-
============
4-
5-
Django CRM is opensource CRM developed on django framework. It has all
6-
the basic features of CRM to start with. We welcome code contributions
7-
and feature requests via github.
8-
9-
## Project Status and Future Direction
10-
11-
### Background
12-
13-
9 years ago, I launched this project with a mission to provide startups with a free, open-source, and customizable CRM solution, addressing the high subscription costs of commercial alternatives. Initially developed as a Django full-stack application, the project evolved significantly with the support of a dedicated team. However, maintaining the team and covering salaries depleted resources, and I was unable to renew the domain. Recognizing the need for a modernized user experience, I explored updating the frontend with React but ultimately faced financial and team constraints.
14-
15-
### Moving Forward
16-
17-
To align with the project’s vision and address these challenges, I’ve shifted development to a new repository using **SvelteKit** and **Prisma** for a robust, fast, and feature-rich framework. A Minimum Viable Product (MVP) was released last week at [MicroPyramid/Django-CRM](https://github.com/MicroPyramid/Django-CRM).
18-
19-
#### Key Updates:
20-
21-
- **Current Repository:** No further updates will be made to this repository.
22-
23-
- **New Repository:** Development will continue in the new SvelteKit-based repository.
24-
25-
- **Mobile App:** Enhancements to the Flutter-based mobile app [MicroPyramid/flutter-crm](https://github.com/MicroPyramid/flutter-crm) will depend on increased user engagement or support from a paying client.
26-
27-
28-
### Future Vision
29-
30-
This project is far from dead, it’s evolving. I’m committed to its growth and open to discussions about its direction, contributions, or potential collaborations. Feel free to reach out with ideas or feedback.
31-
32-
Thank you for your support and understanding.
33-
34-
## Runcode
35-
36-
Runcode is online developer workspace. It is cloud based simple, secure and ready to code workspaces, assuring high performance & fully configurable coding environment. With runcode you can run django-crm(API) with one-click.
1+
# BottleCRM
2+
3+
A modern, open-source CRM platform built with Django REST Framework and SvelteKit.
4+
5+
![License](https://img.shields.io/badge/license-MIT-blue.svg)
6+
![Python](https://img.shields.io/badge/python-3.10+-green.svg)
7+
![Django](https://img.shields.io/badge/django-5.x-green.svg)
8+
![SvelteKit](https://img.shields.io/badge/sveltekit-2.x-orange.svg)
9+
![Svelte](https://img.shields.io/badge/svelte-5-orange.svg)
10+
11+
## Overview
12+
13+
BottleCRM is a full-featured Customer Relationship Management system designed for startups and small businesses. It combines a powerful Django REST API backend with a modern SvelteKit frontend, featuring multi-tenant architecture with PostgreSQL Row-Level Security (RLS) for enterprise-grade data isolation.
14+
15+
**Try it free**: [bottlecrm.io](https://bottlecrm.io/)
16+
17+
## Features
18+
19+
### Core CRM Modules
20+
- **Leads** - Track and manage sales leads through your pipeline
21+
- **Accounts** - Manage company/organization records
22+
- **Contacts** - Store and organize contact information
23+
- **Opportunities** - Track deals and sales opportunities
24+
- **Cases** - Customer support case management
25+
- **Tasks** - Task management with calendar and Kanban board views
26+
- **Invoices** - Create and manage invoices
27+
28+
### Platform Features
29+
- **Multi-Tenant Architecture** - PostgreSQL RLS for secure data isolation between organizations
30+
- **JWT Authentication** - Secure token-based authentication
31+
- **Team Management** - Organize users into teams with role-based access
32+
- **Activity Tracking** - Comprehensive audit logs and activity history
33+
- **Comments & Attachments** - Collaborate with comments and file attachments on any record
34+
- **Tags** - Flexible tagging system for organizing records
35+
- **Email Integration** - AWS SES integration for transactional emails
36+
- **Background Tasks** - Celery + Redis for async task processing
37+
38+
## Tech Stack
39+
40+
### Backend
41+
- **Django 5.x** with Django REST Framework
42+
- **PostgreSQL** with Row-Level Security (RLS)
43+
- **Redis** for caching and Celery broker
44+
- **Celery** for background task processing
45+
- **JWT** for authentication
46+
- **AWS S3** for file storage
47+
- **AWS SES** for email delivery
48+
49+
### Frontend
50+
- **SvelteKit 2.x** with Svelte 5 (runes)
51+
- **TailwindCSS 4** for styling
52+
- **shadcn-svelte** UI components
53+
- **Zod** for schema validation
54+
- **Axios** for API communication
55+
- **Lucide** icons
56+
57+
## Quick Start
58+
59+
### Prerequisites
60+
- Python 3.10+
61+
- Node.js 18+ with pnpm
62+
- PostgreSQL 14+
63+
- Redis
64+
65+
### Backend Setup
66+
67+
```bash
68+
# Clone the repository
69+
git clone https://github.com/MicroPyramid/Django-CRM.git
70+
cd Django-CRM
71+
72+
# Create and activate virtual environment
73+
cd backend
74+
python -m venv venv
75+
source venv/bin/activate # On Windows: venv\Scripts\activate
76+
77+
# Install dependencies
78+
pip install -r requirements.txt
3779

80+
# Set up environment variables (see env.md for details)
81+
cp .env.example .env
82+
# Edit .env with your database and other settings
3883

39-
- Open below link to create django-crm workspace on [RunCode](https://runcode.io/ "RunCode"). It will create django-crm API
84+
# Run migrations
85+
python manage.py migrate
4086

41-
[![RunCode](https://runcode-app-public.s3.amazonaws.com/images/dark_btn.png)](https://runcode.io)
87+
# Create a superuser
88+
python manage.py createsuperuser
4289

43-
- After running API, Go to Frontend UI [React CRM](https://github.com/MicroPyramid/react-crm "React CRM") project to create new workspace with runcode.
90+
# Start the development server
91+
python manage.py runserver
92+
```
4493

45-
## Docs
94+
### Frontend Setup
4695

47-
Please [Click Here](http://django-crm.readthedocs.io "Click Here") for latest documentation.
96+
```bash
97+
# In a new terminal, from the project root
98+
cd frontend
4899

49-
## Project Modules
50-
This project contains the following modules:
51-
- Contacts
52-
- Companies
53-
- Leads
54-
- Accounts
55-
- Invoices (todo)
56-
- Cases (todo)
57-
- Opportunity (todo)
100+
# Install dependencies
101+
pnpm install
58102

59-
## Try for free [here](https://bottlecrm.io/)
103+
# Start the development server
104+
pnpm run dev
105+
```
60106

61-
## Installation Guide
107+
### Start Celery Worker
62108

63-
We recommend ubuntu 20.04. These instructions are verified for ubuntu 20.04.
109+
```bash
110+
# In a new terminal
111+
cd backend
112+
source venv/bin/activate
113+
celery -A crm worker --loglevel=INFO
114+
```
64115

65-
#### To install system requirements
116+
### Access the Application
117+
- **Frontend**: http://localhost:5173
118+
- **API Documentation**: http://localhost:8000/swagger-ui/
119+
- **Admin Panel**: http://localhost:8000/admin/
66120

67-
```
68-
sudo apt update && sudo apt upgrade -y
121+
## Docker Setup
69122

70-
sudo apt install python-is-python3 xvfb libfontconfig wkhtmltopdf python3-dev python3-pip build-essential libssl-dev libffi-dev python3-venv redis-server redis-tools virtualenv -y
123+
```bash
124+
# Build and run with Docker Compose
125+
docker build -t bottlecrm:latest -f docker/dockerfile .
126+
docker-compose -f docker/docker-compose.yml up
71127
```
72128

73-
#### Install dependencies
74-
75-
##### Optional (based on personal choice)
129+
## Project Structure
76130

77131
```
78-
sudo apt update && sudo apt upgrade -y && sudo apt install zsh python3-virtualenv
132+
Django-CRM/
133+
├── backend/ # Django REST API
134+
│ ├── accounts/ # Accounts module
135+
│ ├── cases/ # Cases module
136+
│ ├── common/ # Shared models, utilities, RLS
137+
│ ├── contacts/ # Contacts module
138+
│ ├── invoices/ # Invoices module
139+
│ ├── leads/ # Leads module
140+
│ ├── opportunity/ # Opportunities module
141+
│ ├── tasks/ # Tasks module
142+
│ └── crm/ # Django project settings
143+
├── frontend/ # SvelteKit frontend
144+
│ ├── src/
145+
│ │ ├── lib/ # Components, stores, utilities
146+
│ │ └── routes/ # SvelteKit routes
147+
│ │ ├── (app)/ # Authenticated app routes
148+
│ │ └── (no-layout)/ # Auth pages (login, etc.)
149+
│ └── static/ # Static assets
150+
└── docker/ # Docker configuration
151+
```
79152

80-
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
153+
## Multi-Tenancy & Security
81154

82-
pip install virtualenvwrapper
155+
BottleCRM uses PostgreSQL Row-Level Security (RLS) to ensure complete data isolation between organizations. Every database query is automatically filtered by organization context, providing enterprise-grade security.
83156

84-
echo "source /home/ubuntu/.local/bin/virtualenvwrapper.sh" >> ~/.zshrc
85-
```
157+
```bash
158+
# Check RLS status
159+
python manage.py manage_rls --status
86160

87-
If you want to install postgres, follow https://www.postgresql.org/download/
88-
#### To modify postgresql root password
161+
# Verify RLS user configuration
162+
python manage.py manage_rls --verify-user
89163

90-
```
91-
sudo -u postgres psql
92-
ALTER USER postgres WITH PASSWORD 'root';
164+
# Test data isolation
165+
python manage.py manage_rls --test
93166
```
94167

95-
#### Create and activate a virtual environment.
96-
if you installed and configured virtualenv wrapper then use the following
97-
```
98-
mkvirtualenv <env_name>
99-
workon <env_name>
100-
```
101-
or else
102-
```
103-
virtualenv venv
104-
source venv/bin/activate
105-
```
106-
Install the project's dependency after activating env
107-
108-
```
109-
pip install -r requirements.txt
110-
```
168+
## Development
111169

112-
### Env variables
170+
### Backend Commands
113171

114-
* Then refer to `env.md` for environment variables and keep those in the `.env` file in the current folder as your project is in.
172+
```bash
173+
# Run tests
174+
cd backend && pytest
115175

176+
# Format code
177+
black . && isort .
116178

117-
### Docker / docker-compose
118-
in order to use docker, please run the next commands after cloning repo:
119-
```
120-
docker build -t djcrm:1 -f docker/dockerfile .
121-
docker-compose -f docker/docker-compose.yml up
179+
# Check dependencies
180+
pipdeptree
181+
pip-check -H
122182
```
123183

124-
**Note**: you must have docker/docker-compose installed on your host.
125-
### next steps
184+
### Frontend Commands
126185

186+
```bash
187+
cd frontend
127188

128-
```
129-
python manage.py migrate
130-
python manage.py runserver
131-
```
132-
- Then open http://localhost:8000/swagger-ui/ in your browser to explore API.
133-
134-
- After running API, Go to Frontend UI [React CRM](https://github.com/MicroPyramid/react-crm "React CRM") project to configure Fronted UI to interact with API.
189+
# Type checking
190+
pnpm run check
135191

192+
# Linting
193+
pnpm run lint
136194

137-
## Start celery worker in another terminal window
195+
# Formatting
196+
pnpm run format
197+
```
138198

139-
celery -A crm worker --loglevel=INFO
199+
## API Documentation
140200

141-
### Useful tools and packages
201+
The API follows RESTful conventions:
142202

143203
```
144-
pipdeptree # to see pip dependency tree
145-
black # to format code to meet python coding standards
146-
pip-check -H # to see upgradable packages
147-
isort # to sort imports in python
204+
GET/POST /api/<module>/ # List/Create
205+
GET/PUT/DELETE /api/<module>/<pk>/ # Detail/Update/Delete
206+
GET/POST /api/<module>/comment/<pk>/ # Comments
207+
GET/POST /api/<module>/attachment/<pk>/ # Attachments
148208
```
149209

150-
### Community
210+
Interactive API documentation is available at `/swagger-ui/` when running the backend.
151211

152-
**Note: This repository is no longer actively maintained.** For the latest development and community support, please visit our new SvelteKit-based CRM project:
212+
## Contributing
153213

154-
- **New Project**: [MicroPyramid/Django-CRM](https://github.com/MicroPyramid/Django-CRM)
155-
- Follow [@micropyramid](<https://twitter.com/micropyramid>) on Twitter
156-
- For questions about the legacy Django CRM, check [past issues](<https://github.com/MicroPyramid/Django-CRM/issues>)
157-
- For new feature requests and active development, visit the [new repository](https://github.com/MicroPyramid/Django-CRM)
158-
- For commercial support [Contact us](https://micropyramid.com/contact-us/)
214+
We welcome contributions! Please see our contributing guidelines for details.
159215

160-
## Credits
216+
1. Fork the repository
217+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
218+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
219+
4. Push to the branch (`git push origin feature/amazing-feature`)
220+
5. Open a Pull Request
161221

162-
### Contributors
222+
## Community
163223

164-
This project exists thanks to all the people who contributed during its active development!
224+
- **Issues**: [GitHub Issues](https://github.com/MicroPyramid/Django-CRM/issues)
225+
- **Twitter**: [@micropyramid](https://twitter.com/micropyramid)
226+
- **Commercial Support**: [Contact us](https://micropyramid.com/contact-us/)
165227

166-
![image](https://opencollective.com/django-crm/contributors.svg?width=890&button=false)
228+
## License
167229

168-
### Legacy Project Notice
230+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
169231

170-
This Django CRM repository is now in maintenance mode. While we welcome your feedback and appreciate past contributions, active development has moved to our new SvelteKit-based CRM solution at [MicroPyramid/Django-CRM](https://github.com/MicroPyramid/Django-CRM).
232+
## Contributors
171233

172-
For commercial support [Contact us](https://micropyramid.com/contact-us/)
234+
This project exists thanks to all the people who contributed.
173235

174-
# Trigger deploy
236+
![Contributors](https://opencollective.com/django-crm/contributors.svg?width=890&button=false)
175237

backend/common/middleware/rls_context.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class RequireOrgContext:
110110
"/api/auth/me/",
111111
"/api/auth/switch-org/",
112112
"/api/auth/google/",
113+
"/api/org/",
113114
"/admin/",
114115
"/swagger-ui/",
115116
"/api/schema/",
@@ -121,6 +122,15 @@ def __init__(self, get_response):
121122
def __call__(self, request):
122123
# Check if path requires org context
123124
if not self._is_exempt(request.path):
125+
# Skip check for URLs that don't resolve (let Django return 404)
126+
from django.urls import resolve
127+
from django.urls.exceptions import Resolver404
128+
129+
try:
130+
resolve(request.path)
131+
except Resolver404:
132+
return self.get_response(request)
133+
124134
if not hasattr(request, "org") or request.org is None:
125135
from rest_framework.exceptions import PermissionDenied
126136

backend/crm/server_settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
EMAIL_BACKEND = "django_ses.SESBackend"
3434

35-
SESSION_COOKIE_DOMAIN = ".bottlecrm.com"
35+
SESSION_COOKIE_DOMAIN = ".bottlecrm.io"
36+
SESSION_COOKIE_SECURE = True # Only send session cookie over HTTPS
37+
CSRF_COOKIE_SECURE = True # Only send CSRF cookie over HTTPS
3638

3739
sentry_sdk.init(
3840
dsn=os.environ["SENTRY_DSN"],

0 commit comments

Comments
 (0)