A modern web application that demonstrates the integration of Django, Go, and TypeScript. This project showcases how to leverage Django's robust web framework capabilities, Go's performance benefits for microservices, and TypeScript's type safety for frontend development.
-
Django (Python)
- Main web framework
- User authentication and authorization
- Database operations
- Template rendering
- REST API endpoints
- Business logic layer
-
Go
- High-performance microservices
- Real-time operations
- Background processing
- Caching layer with Redis
- Performance-critical operations
-
PostgreSQL
- Primary database
- Data persistence
- Relational data storage
-
TypeScript
- Type-safe JavaScript development
- Modern ES6+ features
- Component-based architecture
- Strong typing system
-
Bootstrap
- Responsive UI framework
- Modern design components
- Mobile-first approach
-
Webpack
- Asset bundling
- Code optimization
- Development server
- Hot module replacement
django-go-typescript-project/
├── .git/
├── .gitignore
├── README.md
├── docker-compose.yml # For running Django, Go services, and DB
├── Makefile # Helpful commands for development
├── backend/
│ ├── django_project/ # Django main project
│ │ ├── manage.py
│ │ ├── requirements.txt
│ │ ├── core/ # Django project settings
│ │ │ ├── __init__.py
│ │ │ ├── settings/
│ │ │ │ ├── base.py
│ │ │ │ ├── dev.py
│ │ │ │ └── prod.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ └── apps/ # Django applications
│ │ └── main/ # Example app
│ └── go_services/ # Go microservices
│ ├── go.mod
│ ├── go.sum
│ ├── cmd/
│ │ └── api/ # Go API entry point
│ └── internal/ # Go business logic
├── frontend/
│ ├── package.json
│ ├── tsconfig.json
│ ├── webpack.config.js
│ ├── src/
│ │ └── ts/ # TypeScript source files
│ └── static/ # Compiled JS, CSS, etc.
└── static/ # Django collected static files
- Serves as the main web server
- Handles user sessions and authentication
- Manages database operations through Django ORM
- Provides REST API endpoints
- Renders HTML templates
- Serves static files
- Provides high-performance API endpoints
- Manages Redis caching layer
- Handles compute-intensive tasks
- Processes background jobs
- Offers real-time capabilities through WebSocket
- Compiles to JavaScript for browser execution
- Communicates with both Django and Go services
- Manages client-side state
- Handles user interactions
- Provides type-safe development
-
Setup Development Environment:
# Install all dependencies make install
-
Start Development Servers:
# Using docker-compose (recommended) make run # Or manually: cd backend/django_project python manage.py runserver cd backend/go_services go run cmd/api/main.go cd frontend npm run dev
-
Access Development Servers:
- Django: http://localhost:8000
- Go services: http://localhost:8080
- Frontend dev server: http://localhost:3000
- Django handles user registration and authentication
- Session management through Django's auth system
- TypeScript frontend manages login forms and validation
- Go services handle session verification for high-performance endpoints
- User submits data through TypeScript frontend
- Django validates and stores the data
- Go services process the data in background
- Redis caches processed results
- Real-time updates sent to frontend
- Go services manage WebSocket connections
- TypeScript frontend maintains socket connection
- Real-time updates through Go's efficient concurrency
- Django handles persistent storage of real-time data
- Static content served by Django
- Compute-intensive operations handled by Go
- Caching layer managed by Go and Redis
- TypeScript handles client-side caching
- Type hints for better code quality
- Modular settings for different environments
- Django REST Framework for APIs
- Proper authentication and authorization
- Environment variable configuration
- Clean architecture principles
- Proper error handling
- Context for cancellation
- Graceful shutdown
- Structured logging
- Redis integration for caching
- Strict type checking
- Interface-based development
- Modern ES6+ features
- Component-based architecture
- Proper error handling
- API client abstraction
- Docker containerization
- Environment-based configuration
- Comprehensive logging
- Testing infrastructure
- Code formatting and linting
- Asset optimization
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
-
Clone the repository
-
Install dependencies:
make install
-
Create necessary environment files:
.env
in Django project root.env
in Go services directory
-
Start development servers:
make run
-
Start developing!
Run all tests across the stack:
make test
make build
This will:
- Compile TypeScript to JavaScript
- Optimize and bundle assets
- Collect Django static files
- Prepare for deployment
The project is containerized and can be deployed using Docker:
docker-compose -f docker-compose.prod.yml up -d
- Django Documentation: https://docs.djangoproject.com/
- Go Documentation: https://golang.org/doc/
- TypeScript Documentation: https://www.typescriptlang.org/docs/
- Bootstrap Documentation: https://getbootstrap.com/docs/