A modern, enterprise-grade website for Bhanjyang Cooperative built with Django 5.2.3 and Tailwind CSS, featuring comprehensive API, monitoring, and development tools.
- Responsive Design: Mobile-first approach with Tailwind CSS
- Multi-language Support: Nepali and English content
- Team Management: Committee and member management system
- News & Updates: Blog-style updates and events
- Contact Forms: User-friendly contact system with file uploads
- File Downloads: Secure document sharing with analytics
- Admin Panel: Comprehensive Django admin interface
- REST API: Comprehensive API with OpenAPI documentation
- Performance Monitoring: Real-time performance tracking
- Health Checks: Kubernetes-ready health endpoints
- Security: Advanced security middleware and rate limiting
- Caching: Redis-based caching system
- Error Tracking: Sentry integration for production monitoring
- CI/CD: GitHub Actions pipeline with automated testing
- Python 3.11+
- Node.js 18+
- PostgreSQL 15+ (for production)
- Redis 7+ (for production)
- pip and npm
-
Clone the repository
git clone <repository-url> cd Bhanjyang
-
Set up Python virtual environment
python -m venv .venv .\.venv\Scripts\Activate.ps1 # Windows PowerShell # or source .venv/bin/activate # Linux/Mac
-
Quick setup (recommended)
python scripts/setup_dev.py
-
Manual setup
# Install dependencies pip install -r requirements-dev.txt npm install # Set up environment cp env.template .env # Edit .env with your configuration # Database setup python manage.py migrate python manage.py createsuperuser # Build assets npm run build python manage.py collectstatic --noinput
-
Start the development server
python manage.py runserver # or make dev
make dev- Start development servermake test- Run tests with coveragemake lint- Run linting checksmake format- Format codemake check- Run all checksmake docker-compose-up- Start with Docker Composemake quick-start- Complete development setup
npm run dev- Watch mode for Tailwind CSS compilationnpm run build- Build production CSSnpm run start- Start Django development server
python manage.py runserver- Start development serverpython manage.py test- Run testspython manage.py shell- Django shell
The project includes comprehensive development tools:
- Code Formatting: Black, isort
- Linting: flake8, mypy
- Security: bandit, safety
- Testing: pytest, coverage
- Pre-commit Hooks: Automated code quality checks
- Docker: Containerized development environment
Copy env.template to .env and configure:
# Security
SECRET_KEY=your-secret-key-here
DEBUG=True
# Database (Production)
DB_NAME=bhanjyang_coop
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=localhost
DB_PORT=5432
# Redis
REDIS_URL=redis://localhost:6379/0
# Email
SEND_REAL_EMAILS=False
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
# Monitoring
SENTRY_DSN=your-sentry-dsnThe project uses multiple settings files:
coop/settings.py- Base settingscoop/settings_dev.py- Development settingscoop/production.py- Production settings
The documentation is organized into the following directories:
π Guides
User guides and how-to documentation:
- Next Steps Guide - Deployment and setup guide
- Error Reporting Guide - Error reporting configuration
- Performance Monitoring - Performance monitoring system
- Static Files Guide - Static files organization
- Image Upload Guidelines - Image upload best practices
π Migrations
Migration and refactoring history:
- Folder structure improvements
- Standardization progress
- Migration completion status
π± Apps
App-specific documentation:
- Contact App - Contact app management
- Gallery App - Gallery app documentation
π Standards
Design and coding standards:
- Design System Standards - Design system guidelines
π Deployment
Deployment guides and configuration:
- Production deployment
- Docker setup
- Nginx configuration
π» Development
Development guides and workflows
π API
API documentation:
- REST API endpoints
- Authentication
- API usage examples
π¦ Archive
Historical documentation and archived files
- Services API:
/api/v1/savings-accounts/,/api/v1/loan-types/, etc. - Health Checks:
/health/,/health/readiness/,/health/liveness/ - API Documentation:
/api/docs/(Swagger UI) - API Schema:
/api/schema/(OpenAPI schema)
- Authentication: Token and session authentication
- Rate Limiting: Configurable rate limits
- Filtering: Advanced filtering and search
- Pagination: Page-based pagination
- Documentation: Auto-generated OpenAPI docs
For detailed API documentation, see API Documentation.
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Access Django shell
docker-compose exec web python manage.py shell
# Stop services
docker-compose down# Build image
docker build -t bhanjyang-coop .
# Run container
docker run -p 8000:8000 bhanjyang-coop# Run all tests
make test
# Run with coverage
make test-coverage
# Run specific app tests
python manage.py test apps.services
# Run with pytest
pytestThe project maintains >80% test coverage across all apps.
- Rate Limiting: Per-IP and per-user rate limits
- Input Validation: Comprehensive input sanitization
- Brute Force Protection: Login attempt monitoring
- Security Headers: CSP, HSTS, XSS protection
- File Upload Security: Type and size validation
- API Security: Token authentication and permissions
- Bandit: Python security linting
- Safety: Dependency vulnerability scanning
- Trivy: Container vulnerability scanning
- Health Check:
/health/- Comprehensive health status - Readiness:
/health/readiness/- Kubernetes readiness probe - Liveness:
/health/liveness/- Kubernetes liveness probe - Metrics:
/health/metrics/- Application metrics
- Real-time Metrics: Page load times, error rates
- Database Monitoring: Query performance tracking
- Cache Monitoring: Redis performance metrics
- User Analytics: Session tracking and behavior analysis
- Sentry Integration: Production error tracking
- Log Aggregation: Structured logging with rotation
- Alert System: Configurable performance alerts
-
Environment Setup
- Set
DEBUG=False - Configure PostgreSQL database
- Set up Redis cache
- Configure email backend
- Set up Sentry monitoring
- Set
-
Security Configuration
- Enable HTTPS/SSL
- Set secure cookie settings
- Configure CORS origins
- Set up security headers
-
Performance Optimization
- Enable Redis caching
- Configure CDN for static files
- Set up database connection pooling
- Enable compression
- VPS: DigitalOcean, Linode, AWS EC2
- Platform: Heroku, Railway, PythonAnywhere
- Container: Docker, Kubernetes
- Cloud: AWS, Google Cloud, Azure
The project includes a comprehensive CI/CD pipeline:
- Testing: Automated test execution
- Code Quality: Linting, formatting, security checks
- Build: Docker image building
- Deployment: Staging and production deployments
- Security: Vulnerability scanning
- Test: Run tests, linting, security checks
- Build: Create deployment artifacts
- Deploy: Deploy to staging/production
- Notify: Send notifications on success/failure
- Database: Query optimization, indexing, connection pooling
- Caching: Redis-based multi-level caching
- Static Files: CDN integration, compression
- Images: Automatic optimization and WebP support
- API: Response caching and pagination
- Page Load Time: < 2 seconds
- API Response Time: < 500ms
- Error Rate: < 0.1%
- Uptime: > 99.9%
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and checks:
make check - Commit with conventional commits
- Push to your fork
- Submit a pull request
- Formatting: Black, isort
- Linting: flake8, mypy
- Testing: pytest with >80% coverage
- Documentation: Comprehensive docstrings
- Security: Bandit, safety checks
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the Guides directory for how-to guides
- API Documentation: See API Documentation for API details
- Deployment: See Deployment Guide for deployment help
- Issues: Create GitHub issues for bugs
- Discussions: Use GitHub discussions for questions
- Email: Contact the development team
- Regular Updates: Monthly dependency updates
- Security Patches: Immediate security updates
- Feature Releases: Quarterly feature releases
- Bug Fixes: Weekly bug fix releases
This project is licensed under the MIT License.
For support or questions, please contact the development team or create an issue in the repository.
Built with β€οΈ for Bhanjyang Cooperative