Initial template: Vue 3 + FastAPI + SQLite full-stack with K8s deployment
Extracted from oil project — business logic removed, auth/db/deploy infrastructure generalized with APP_NAME placeholders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
73
README.md
Normal file
73
README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Base Template
|
||||
|
||||
Vue 3 + FastAPI + SQLite full-stack template with K8s deployment.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Frontend**: Vue 3 + Vite + Pinia + Vue Router
|
||||
- **Backend**: FastAPI + SQLite (WAL mode) + uvicorn
|
||||
- **Testing**: Vitest (unit) + Cypress (E2E)
|
||||
- **Deploy**: Docker multi-stage build → K8s (k3s + Traefik)
|
||||
- **CI/CD**: Gitea Actions (test → deploy, PR preview)
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Frontend
|
||||
cd frontend && npm install && npm run dev
|
||||
|
||||
# Backend (in another terminal)
|
||||
pip install -r backend/requirements.txt
|
||||
DB_PATH=./dev.db uvicorn backend.main:app --reload --port 8000
|
||||
```
|
||||
|
||||
Frontend dev server proxies `/api` to `localhost:8000`.
|
||||
|
||||
## Setup for New Project
|
||||
|
||||
1. Replace all `APP_NAME` placeholders in `deploy/`, `scripts/`, and `.gitea/workflows/`
|
||||
2. Add your tables to `backend/database.py` → `init_db()`
|
||||
3. Add your routes to `backend/main.py`
|
||||
4. Add your pages to `frontend/src/views/` and register in `frontend/src/router/index.js`
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm run test:unit # Vitest
|
||||
npm run test:e2e # Cypress (requires both servers running)
|
||||
npm test # Both
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
```bash
|
||||
# Production
|
||||
python3 scripts/deploy-preview.py deploy-prod
|
||||
|
||||
# PR preview
|
||||
python3 scripts/deploy-preview.py deploy <PR_ID>
|
||||
python3 scripts/deploy-preview.py teardown <PR_ID>
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
├── frontend/
|
||||
│ ├── src/
|
||||
│ │ ├── composables/useApi.js # HTTP client with auth
|
||||
│ │ ├── stores/auth.js # Auth state (Pinia)
|
||||
│ │ ├── router/index.js # Routes
|
||||
│ │ ├── views/ # Page components
|
||||
│ │ └── assets/styles.css # Design tokens + base styles
|
||||
│ ├── cypress/ # E2E tests
|
||||
│ └── vite.config.js
|
||||
├── backend/
|
||||
│ ├── main.py # FastAPI app + routes
|
||||
│ ├── auth.py # Auth dependencies
|
||||
│ └── database.py # SQLite init + helpers
|
||||
├── deploy/ # K8s manifests (replace APP_NAME)
|
||||
├── scripts/deploy-preview.py # Deploy automation
|
||||
├── .gitea/workflows/ # CI/CD pipelines
|
||||
└── Dockerfile # Multi-stage build
|
||||
```
|
||||
Reference in New Issue
Block a user