|
| 1 | +# Towlion App Template |
| 2 | + |
| 3 | +A template repository for bootstrapping new applications on the [Towlion platform](https://github.com/towlion/platform). |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. Click **"Use this template"** on GitHub to create a new repository |
| 8 | +2. Clone your new repo and configure environment variables |
| 9 | +3. Build and deploy |
| 10 | + |
| 11 | +## Project Structure |
| 12 | + |
| 13 | +``` |
| 14 | +app/ # FastAPI backend |
| 15 | + main.py # Application entry point |
| 16 | + Dockerfile # Backend container image |
| 17 | + models.py # SQLAlchemy models |
| 18 | + tasks.py # Celery background tasks |
| 19 | + alembic/ # Database migrations |
| 20 | +deploy/ |
| 21 | + docker-compose.yml # App containers (multi-app mode) |
| 22 | + docker-compose.standalone.yml # Full stack (self-hosted) |
| 23 | + Caddyfile # Reverse proxy config |
| 24 | + env.template # Environment variable reference |
| 25 | +frontend/ # Optional Next.js frontend |
| 26 | +scripts/ |
| 27 | + health-check.sh # Deployment health check |
| 28 | +``` |
| 29 | + |
| 30 | +## Local Development |
| 31 | + |
| 32 | +```bash |
| 33 | +# Install dependencies |
| 34 | +pip install -r requirements.txt |
| 35 | + |
| 36 | +# Run the app |
| 37 | +uvicorn app.main:app --reload --port 8000 |
| 38 | + |
| 39 | +# Verify it works |
| 40 | +curl http://localhost:8000/health |
| 41 | +``` |
| 42 | + |
| 43 | +## Environment Variables |
| 44 | + |
| 45 | +Copy `deploy/env.template` to `deploy/.env` and fill in your values. See the [platform spec](https://github.com/towlion/platform/blob/main/docs/spec.md) for details on required and optional variables. |
| 46 | + |
| 47 | +## Deployment |
| 48 | + |
| 49 | +### Multi-app mode (managed server) |
| 50 | + |
| 51 | +Push to `main` to trigger the deploy workflow. The GitHub Action SSHs into the server and runs: |
| 52 | + |
| 53 | +```bash |
| 54 | +docker compose -f deploy/docker-compose.yml up -d --build |
| 55 | +``` |
| 56 | + |
| 57 | +### Self-hosting (fork mode) |
| 58 | + |
| 59 | +For standalone deployment on a single server: |
| 60 | + |
| 61 | +```bash |
| 62 | +cp deploy/env.template deploy/.env |
| 63 | +# Edit deploy/.env with your values |
| 64 | +docker compose -f deploy/docker-compose.standalone.yml up -d |
| 65 | +``` |
| 66 | + |
| 67 | +This includes PostgreSQL, Redis, MinIO, and Caddy alongside your app. |
| 68 | + |
| 69 | +## License |
| 70 | + |
| 71 | +[MIT](LICENSE) |
0 commit comments