A powerful analytics platform that provides real-time event tracking and AI-powered insights for your applications.
- π Organization-based authentication with email OTP verification
- π Real-time event tracking and analytics
- π€ AI-powered insights using DeepSeek
- πΎ Efficient data storage with PostgreSQL and TimescaleDB
- π High-performance caching with Redis
- π Subscription plans (Free, Starter, Enterprise)
- π RESTful API with FastAPI
- π³ Docker containerization
- Backend: FastAPI, Python 3.11
- Database: PostgreSQL with TimescaleDB
- Caching: Redis
- AI Integration: DeepSeek
- Authentication: JWT, Email OTP
- Infrastructure: Docker, Docker Compose
- Python 3.11 or higher
- Docker and Docker Compose
- PostgreSQL
- Redis
- Rust (for building some Python dependencies)
- Clone the repository:
git clone https://github.com/yourusername/analytics-saas.git
cd analytics-saas- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration- Start services using Docker Compose:
docker-compose up -d- Run database migrations:
alembic upgrade headCreate a .env file with the following variables:
DATABASE_URL=postgresql://user:password@localhost:5432/analytics_db
REDIS_URL=redis://localhost:6379
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
DEEPSEEK_API_KEY=your-deepseek-api-key
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-passwordanalytics_saas/
βββ alembic/ # Database migrations
βββ app/
β βββ api/ # API endpoints
β β βββ v1/
β βββ core/ # Core configuration
β βββ db/ # Database setup
β βββ models/ # Database models
β βββ schemas/ # Pydantic schemas
β βββ services/ # Business logic
β βββ utils/ # Utilities
βββ tests/ # Test files
βββ alembic.ini # Alembic config
βββ docker-compose.yml # Docker services
βββ Dockerfile # Docker config
βββ requirements.txt # Python dependencies
After starting the server, visit:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
-
Authentication:
- POST
/api/v1/auth/signup- Organization signup - POST
/api/v1/auth/verify- OTP verification
- POST
-
Events:
- POST
/api/v1/events- Track events - GET
/api/v1/events- Retrieve events
- POST
-
Analysis:
- POST
/api/v1/analysis/custom- Custom analysis - GET
/api/v1/analysis- Get analysis
- POST
-
Organization:
- GET
/api/v1/organizations/me- Get organization details - PUT
/api/v1/organizations/me- Update organization
- GET
- Run unit tests:
pytest- Run with coverage:
pytest --cov=app tests/Add this to your website:
<script>
(function(w,d,s,o,f,js,fjs){
w['Analytics']=o;w[o]=w[o]||function(){
(w[o].q=w[o].q||[]).push(arguments)};
js=d.createElement(s),fjs=d.getElementsByTagName(s)[0];
js.id=o;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
}(window,document,'script','ana','https://your-domain.com/tracker.js'));
ana('init', 'YOUR_ORG_ID');
</script>- Start services in development mode:
docker-compose -f docker-compose.dev.yml up -d- Run the FastAPI server with auto-reload:
uvicorn main:app --reload- Build production images:
docker-compose -f docker-compose.prod.yml build- Deploy:
docker-compose -f docker-compose.prod.yml up -d- Service health:
http://localhost:8000/health - Metrics:
http://localhost:8000/metrics - Logs:
docker-compose logs -f
-
Free:
- 10,000 events/month
- 30 days retention
- Basic analytics
-
Starter:
- 100,000 events/month
- 90 days retention
- Advanced analytics
-
Enterprise:
- Unlimited events
- 365 days retention
- Custom analytics
- Priority support
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@yourcompany.com or open an issue in the GitHub repository.
- FastAPI
- PostgreSQL
- Redis
- DeepSeek
- All other open-source contributors