5.2 KiB
5.2 KiB
SIBU - Sistema de Transporte
A full-stack public transportation application for tracking bus routes, schedules, and providing transportation services information.
Project Structure
sibu/
├── backend/ # FastAPI backend (uv)
├── frontend/ # Vue3 frontend (Bun)
├── old/ # Archived Flutter app
└── .cursor/ # Cursor IDE rules
Tech Stack
Backend
- FastAPI - Modern Python web framework
- SQLModel - SQL database ORM (combines SQLAlchemy + Pydantic)
- PostgreSQL - Database
- uv - Fast Python package manager
- Alembic - Database migrations
Frontend
- Vue 3 - Progressive JavaScript framework
- Vite - Fast build tool
- TypeScript - Type-safe JavaScript
- Pinia - State management
- Vue Router - Client-side routing
- Bun - Fast JavaScript runtime and package manager
- Google Maps API - Map integration
Getting Started
Prerequisites
- Python 3.13+ (for backend)
- uv (Python package manager)
- Node.js 18+ or Bun (for frontend)
- PostgreSQL database
- Make (for using Makefile commands)
Quick Start with Makefile
The easiest way to get started is using the provided Makefile:
- Install all dependencies:
make setup
- Set up environment variables:
# Backend: Copy and edit .env.development
cd backend && cp .env.example .env.development
# Edit backend/.env.development with your database URL
# Frontend: Copy and edit .env.development
cd frontend && cp .env.example .env.development
# Edit frontend/.env.development with your API URL and Google Maps key
- Apply database migrations:
make migrate-up
- Run both backend and frontend:
make dev
Or run them separately:
make dev-backend # Backend only (http://localhost:8000)
make dev-frontend # Frontend only (http://localhost:5173)
Manual Setup
Backend Setup
- Navigate to backend directory:
cd backend
- Install dependencies:
uv sync
- Set up environment variables:
# Copy and edit .env.development
cp .env.example .env.development
# Edit .env.development with your database URL
- Run database migrations:
uv run alembic upgrade head
- Start the development server:
uv run fastapi dev app/main.py
The API will be available at http://localhost:8000
Frontend Setup
- Navigate to frontend directory:
cd frontend
- Install dependencies:
bun install
- Set up environment variables:
# Copy and edit .env.development
cp .env.example .env.development
# Edit .env.development with your API URL and Google Maps key
- Start the development server:
bun run dev
The app will be available at http://localhost:5173
Environment Variables
Backend (.env.development)
DATABASE_URL=postgresql+asyncpg://localhost:5432/sibu_dev
ENVIRONMENT=development
DEBUG=true
Frontend (.env.development)
VITE_API_URL=http://localhost:8000
VITE_GOOGLE_MAPS_API_KEY=your-google-maps-api-key-here
API Endpoints
GET /api/routes- Get all routesGET /api/routes/{id}- Get route by IDGET /api/routes/{id}/stops- Get stops for a routeGET /api/bus-stops- Get all bus stopsGET /api/bus-stops/{id}- Get bus stop by IDGET /api/bus-stops/{id}/routes- Get routes for a bus stopGET /api/schedules- Get schedules (query params: route_id, stop_id)GET /api/coupons- Get couponsGET /api/taxis- Get taxis
Development
Makefile Commands
The project includes a Makefile with convenient commands:
Installation:
make install- Install all dependenciesmake install-backend- Install backend dependencies onlymake install-frontend- Install frontend dependencies onlymake setup- Full setup (install + instructions)
Development:
make dev- Run both backend and frontend concurrentlymake dev-backend- Run backend development servermake dev-frontend- Run frontend development server
Migrations:
make migrate-up- Apply all pending migrationsmake migrate-down- Rollback last migrationmake migrate-create NAME=migration_name- Create a new migrationmake migrate-history- Show migration historymake migrate-current- Show current migration version
Building:
make build- Build both backend and frontendmake build-backend- Build backend onlymake build-frontend- Build frontend only
Other:
make clean- Clean all build artifactsmake test- Run all testsmake help- Show all available commands
Manual Commands
Backend Commands
uv add <package>- Add a dependencyuv run fastapi dev app/main.py- Run development serveruv run fastapi run app/main.py- Run production serveruv run alembic upgrade head- Run database migrationsuv run alembic revision --autogenerate -m "name"- Create migration
Frontend Commands
bun add <package>- Add a dependencybun run dev- Run development serverbun run build- Build for production
Project Conventions
See .cursor/rules/main.mdc for detailed coding conventions and best practices.
License
[Your License Here]