GameCrew GitHub page
GameCrew/
|-- app/
| |-- __init__.py
| |-- database.py
| |-- models.py
| |-- schemas.py
| `-- routers/
| |-- __init__.py
| |-- auth.py
| |-- games.py
| |-- pages.py
| |-- players.py
| `-- search.py
|-- static/
| `-- css/site.css
|-- templates/
| |-- base.html
| |-- game.html
| `-- index.html
|-- tests/
| `-- test_app_stubs.py
|-- main.py
|-- requirements.txt
`-- README.md
main.py: Entry point only. Keep this minimal and avoid feature logic here.app/__init__.py: App factory and global app wiring (router registration, middleware setup, startup wiring).app/database.py: Database engine/session setup and database-related bootstrapping.app/models.py: SQLAlchemy persistence models (tables and relationships).app/schemas.py: Pydantic request/response contracts used by routes.app/routers/pages.py: HTML page routes that render Jinja2 templates.app/routers/auth.py: Auth HTTP endpoints (register/login/logout and session-related handlers).app/routers/players.py: Player profile and player game-stats endpoints.app/routers/games.py: Game catalog and single-game endpoints.app/routers/search.py: Per-game player search endpoints only.templates/: Server-rendered HTML templates. Add new page templates here.static/: Frontend assets such as CSS/JS/images used by templates.tests/: Automated tests for routes, responses, and logic.
When adding a new feature, follow this sequence:
- Define or update request/response schemas in
app/schemas.py. - Add or update persistence entities in
app/models.pyif database storage is needed. - Add endpoint handlers in the correct router under
app/routers/. - If the feature is page-based, add/update templates in
templates/and static assets instatic/. - Register new router modules in
app/__init__.pyif you create a new router file. - Add tests in
tests/.
- API endpoints should stay under
/api/.... - Page routes should remain non-API routes (for example
/and/game/{game_slug}). - Search stays per-game (for example
/api/search/games/{game_slug}/players).
- Create a virtual environment:
# Windows
python -m venv .venv
# macOS
python3 -m venv .venv- Activate the virtual environment:
# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1
# macOS
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Run the app:
uvicorn main:app --reload- Open in browser:
- Home page:
http://127.0.0.1:8000/ - Example game page:
http://127.0.0.1:8000/game/counterstrike - API docs:
http://127.0.0.1:8000/docs
python -m pytest -q