A full-stack web application that combines stock trading with astrological insights, featuring real-time market data, personalized horoscopes, and zodiac-based stock recommendations.
- Real-time Stock Data: Live market prices and historical data via yfinance
- Astrological Integration: Daily horoscopes and zodiac-based stock matching
- Portfolio Management: Buy/sell stocks with portfolio tracking
- User Authentication: JWT-based auth with Django REST Framework
- Responsive UI: Modern Next.js frontend with Tailwind CSS
- Background Processing: Automated price updates and horoscope generation
Group #3
- Andrew Berg (Frontend, Full-stack)
- Dalton Boone (Backend, API)
- Jason Bluhm (QA, Docs)
- Devon Traynham (QA, Docs)
- Docker & Docker Compose (for containerized setup)
- Node.js 18+ (for local frontend development)
- Python 3.13+ (for local backend development)
- PostgreSQL 16+ (for local database)
- UV Package Manager (Installation Guide)
# Start all services (backend, frontend, database)
docker compose up
# Or start specific services
docker compose up frontend backend pgsql
# Run in background
docker compose up -d- Frontend: http://localhost:6969
- Backend API: http://localhost:42069
- Database: localhost:5432
- Health Check: http://localhost:42069/health/
| Service | Port | Description |
|---|---|---|
frontend |
6969 | Next.js React application |
backend |
42069 | Django REST API server |
pgsql |
5432 | PostgreSQL database |
testing |
42061 | Test automation service |
Create a .env file in the project root:
# Database Configuration
POSTGRES_HOST=localhost
POSTGRES_DB=zentrading
POSTGRES_USER=zenuser
POSTGRES_PASSWORD=zenpass
POSTGRES_PORT=5432
# Django Configuration
SECRET_KEY=your-secret-key-here
DJANGO_DEBUG=1
CLEAR_DB=false
# Optional: Google AI API for horoscope generation
GOOGLE_AI_API_KEY=your-google-ai-key# Install PostgreSQL locally or use Docker
# Option A: Local PostgreSQL
createdb zentrading
# Option B: Docker PostgreSQL only
docker compose up pgsql -d# Navigate to backend directory
cd backend
# Install dependencies with UV
uv sync
# Run database migrations
uv run manage.py migrate
# Populate initial data
uv run manage.py populate_stocks
uv run manage.py populate_zodiac_matching
uv run manage.py fetch_initial_prices
# Set up scheduled tasks
uv run manage.py setup_price_updates
uv run manage.py setup_horoscope_schedule
# Start background worker (in separate terminal)
uv run manage.py qcluster
# Start Django server
uv run manage.py runserver 0.0.0.0:42069# Navigate to frontend directory
cd frontend
# Install Node.js dependencies
npm installCreate frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:42069
INTERNAL_API_URL=http://localhost:42069# Start Next.js development server
npm run dev
# Or with custom port
npm run dev -- -p 6969# Using Django management command
cd backend
uv run manage.py clear_db
# Or using Docker
docker compose exec backend uv run manage.py clear_db# Create new migrations
cd backend
uv run manage.py makemigrations
# Apply migrations
uv run manage.py migrate
# Reset migrations (if needed)
uv run manage.py migrate --fake-initial# Start all backend services
cd backend
uv run startup.py
# Individual services
uv run manage.py runserver 0.0.0.0:42069 # Django server
uv run manage.py qcluster # Background worker
uv run manage.py shell # Django shell
uv run manage.py collectstatic # Collect static files
# Data management
uv run manage.py populate_stocks # Load stock data
uv run manage.py fetch_initial_prices # Get current prices
uv run manage.py generate_horoscopes # Generate daily horoscopes# Development
npm run dev # Start dev server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Custom ports
npm run dev -- -p 3000 # Custom port# Service management
docker compose up # Start all services
docker compose up -d # Start in background
docker compose down # Stop all services
docker compose restart backend # Restart specific service
# Logs and debugging
docker compose logs backend # View backend logs
docker compose logs -f frontend # Follow frontend logs
docker compose exec backend bash # Access backend container
# Database operations
docker compose exec pgsql psql -U zenuser -d zentrading # Access databaseCommon authentication endpoints:
# Register new user
POST http://localhost:42069/api/register/
{
"username": "testuser",
"email": "test@example.com",
"password1": "securepassword123",
"password2": "securepassword123"
}
# Login
POST http://localhost:42069/api/auth/token/
{
"username": "testuser",
"password": "securepassword123"
}
# Get user profile
GET http://localhost:42069/api/users/me/
Authorization: Bearer <your-jwt-token># Run test suite
cd testing
node test-auth.js # Authentication tests
node test-complete-flow.js # End-to-end tests
node test-portfolio.js # Portfolio tests
node test-horoscope-api.js # Horoscope API testsPOST /api/register/- User registrationPOST /api/auth/token/- Login (get JWT)POST /api/auth/token/refresh/- Refresh JWTGET /api/users/me/- Current user profile
GET /api/stocks/- List all stocksGET /api/stocks/{ticker}/- Stock detailsGET /api/stocks/{ticker}/history/- Stock price historyGET /api/market/status/- Market open/closed status
GET /api/portfolio/- Portfolio summaryGET /api/portfolio/history/- Portfolio value historyGET /api/holdings/- User stock holdingsPOST /api/holdings/- Buy/sell stocks
GET /api/horoscope/- Daily horoscopeGET /api/zodiac/matched-stocks/- Zodiac-based stock recommendationsGET /api/zodiac/matching-rules/- Zodiac matching rules
GET /api/watchlist/- User watchlistPOST /api/watchlist/- Add to watchlistGET /api/dislike-list/- User dislike list
Backend won't start:
# Check database connection
docker compose exec pgsql pg_isready -U zenuser -d zentrading
# Check logs
docker compose logs backend
# Reset database
docker compose down -v
docker compose up pgsql -dFrontend build errors:
# Clear Next.js cache
rm -rf frontend/.next
npm run build
# Check Node.js version
node --version # Should be 18+Database connection issues:
# Verify PostgreSQL is running
docker compose ps pgsql
# Check database exists
docker compose exec pgsql psql -U zenuser -l- Backend: Increase Gunicorn workers in
startup.py - Frontend: Enable Next.js production optimizations
- Database: Add indexes for frequently queried fields
- Caching: Implement Redis for session storage
- Database: Uses PostgreSQL with Django ORM
- Authentication: JWT tokens with 30-minute expiry
- Background Tasks: Django-Q2 for price updates and horoscopes
- API: RESTful design with Django REST Framework
- Frontend: Next.js 15 with TypeScript and Tailwind CSS
- Deployment: Docker containerization with health checks