Opensource Site Tracking Wiki
Self-hosted private analytics for real-time multi-site tracking.
Brought to you by:
autobotsolution
This guide will help you install and set up OpenSite Analytics on your server.
cd backend
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip3 install -r requirements.txt
Copy the example environment file:
cp .env.example .env
Edit .env and configure the following:
# Database
DATABASE_URL=sqlite:///./analytics.db
# API Settings
API_HOST=0.0.0.0
API_PORT=8000
# JWT Settings
SECRET_KEY=your-secret-key-change-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# CORS Settings
CORS_ORIGINS=["http://localhost:3000"]
# Rate Limiting
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_PERIOD=60
# Data Retention
DATA_RETENTION_DAYS=90
python3 init_db.py
This will create the database tables and a default user:
admin@example.comadmin123Important: Change the default password after first login.
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
The backend will be available at http://localhost:8000
cd frontend
npm install
Create a .env.local file:
NEXT_PUBLIC_API_URL=http://localhost:8000
npm run dev
The frontend will be available at http://localhost:3000
http://localhost:3000admin@example.com / admin123If you encounter dependency conflicts, try:
pip3 install --upgrade pip
pip3 install -r requirements.txt --force-reinstall
If port 8000 or 3000 is already in use, you can change them in the .env files or use different ports:
# Backend
uvicorn main:app --host 0.0.0.0 --port 8001 --reload
# Frontend
npm run dev -- -p 3001
If you encounter database errors, you can reset the database:
rm backend/analytics.db
python3 backend/init_db.py
For production deployment, see DEPLOYMENT.md