A production-ready, real-time collaborative LaTeX editor built with modern cloud-native technologies.
- Real-time Collaboration: Multiple users can edit documents simultaneously using CRDTs (Yjs)
- LaTeX Compilation: Support for pdflatex, xelatex, and lualatex
- Cloud Storage: Secure file storage with MinIO (S3-compatible)
- User Authentication: JWT-based authentication with refresh tokens
- Project Management: Create, share, and manage LaTeX projects
- Monitoring: Built-in Prometheus metrics and Grafana dashboards
- API Gateway: Kong gateway with rate limiting and authentication
- Microservices: Scalable microservices architecture in Go
βββββββββββββββ
β Frontend β (React + Monaco Editor)
ββββββββ¬βββββββ
β
ββββββββΌβββββββββββ
β Kong Gateway β (Rate Limiting, Auth, Routing)
ββββββββ¬βββββββββββ
β
ββββββββ΄βββββββββββββββββββββββββββββββββββββ
β β
β ββββββββββββ ββββββββββββ βββββββββββ β
β β Auth β β Project β β WebSocketβ β
β β Service β β Service β β Service β β
β ββββββββββββ ββββββββββββ βββββββββββ β
β β
β ββββββββββββ ββββββββββββ β
β βCollabora-β βCompila- β β
β βtion Svc β βtion Svc β β
β ββββββββββββ ββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββ΄βββββββββββββββββββββββββββββββββββββ
β ββββββββββ ββββββββ ββββββββ β
β βMongoDB β β Redisβ β MinIOβ β
β ββββββββββ ββββββββ ββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββ
- Docker and Docker Compose (20.10+)
- Go 1.21+ (for local development)
- Node.js 18+ and npm (for frontend development)
- Make (optional, for convenience commands)
git clone https://github.com/yourusername/texflow.git
cd texflowmake generate-keysOr manually:
mkdir -p keys
openssl genrsa -out keys/jwt-private.pem 4096
openssl rsa -in keys/jwt-private.pem -pubout -out keys/jwt-public.pemcp .env.example .env
# Edit .env with your configurationmake docker-up
# OR
docker-compose -f deployments/docker/docker-compose.yml up -ddocker-compose -f deployments/docker/docker-compose.yml psAll services should show as "healthy" after a few moments.
- Auth Service: http://localhost:8080
- Project Service: http://localhost:8081
- WebSocket Service: http://localhost:8082
- Collaboration Service: http://localhost:8083
- Compilation Service: http://localhost:8084
- Kong API Gateway: http://localhost:8000
- Kong Admin API: http://localhost:8001
- MinIO Console: http://localhost:9001
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000
make buildmake run-auth
make run-project
make run-websocket
make run-collaboration
make run-compilationmake testmake docker-logsPOST /api/v1/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"username": "johndoe",
"password": "securepassword123",
"full_name": "John Doe"
}POST /api/v1/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "securepassword123"
}Response:
{
"user": {
"id": "...",
"email": "user@example.com",
"username": "johndoe",
"full_name": "John Doe"
},
"access_token": "eyJ...",
"refresh_token": "eyJ...",
"expires_in": 900
}GET /api/v1/auth/me
Authorization: Bearer <access_token>POST /api/v1/projects
Authorization: Bearer <access_token>
Content-Type: application/json
{
"name": "My Research Paper",
"description": "PhD thesis on Machine Learning",
"compiler": "pdflatex",
"is_public": false,
"tags": ["research", "ml"]
}GET /api/v1/projects?page=1&limit=10
Authorization: Bearer <access_token>GET /api/v1/projects/:id
Authorization: Bearer <access_token>texflow/
βββ services/
β βββ auth/ # Authentication service
β βββ project/ # Project management service
β βββ websocket/ # WebSocket service for real-time features
β βββ collaboration/ # Collaboration service (Yjs)
β βββ compilation/ # LaTeX compilation service
βββ frontend/ # React frontend
βββ infrastructure/
β βββ kong/ # Kong API Gateway configuration
β βββ prometheus/ # Prometheus configuration
β βββ grafana/ # Grafana dashboards
βββ deployments/
β βββ docker/ # Docker Compose files
β βββ kubernetes/ # Kubernetes manifests
βββ docs/ # Documentation
βββ Makefile # Build and deployment commands
βββ README.md
All services can be configured via environment variables. See .env.example for a complete list.
Key variables:
MONGO_URI: MongoDB connection stringREDIS_ADDR: Redis addressMINIO_ENDPOINT: MinIO endpointJWT_SECRET: Secret for JWT signing (use RSA keys in production)COMPILATION_TIMEOUT: Maximum compilation time (default: 30s)
Each service exposes metrics at /metrics. Key metrics include:
- HTTP request rates and latencies
- Database operation metrics
- Active WebSocket connections
- Compilation queue depth and duration
- Cache hit rates
Access Grafana at http://localhost:3000 (default credentials: admin/admin)
Pre-configured dashboards:
- Service Health Dashboard: Overview of all services
- Compilation Metrics: Compilation performance and queue status
- Database Performance: MongoDB and Redis metrics
- Infrastructure Overview: CPU, memory, and network usage
- JWT authentication with RS256 signing
- Password hashing with bcrypt (cost factor: 12)
- Docker container isolation for compilation
- No network access for compilation containers
- Rate limiting via Kong API Gateway
- CORS configuration
- Input validation and sanitization
docker-compose -f deployments/docker/docker-compose.yml up -dkubectl apply -f deployments/kubernetes/- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- TeX Live for LaTeX compilation
- Yjs for CRDT-based collaboration
- Monaco Editor for code editing
- Kong for API Gateway
- MinIO for object storage
For questions or support, please open an issue on GitHub.
Built with β€οΈ using Go, React, MongoDB, and Docker