create-idp 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -127
- package/dist/index.js +86 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/django/README.md +27 -0
- package/templates/django/_gitignore +20 -0
- package/templates/django/_template.json +14 -0
- package/templates/django/manage.py +22 -0
- package/templates/django/project_name/__init__.py +1 -0
- package/templates/django/project_name/asgi.py +11 -0
- package/templates/django/project_name/settings.py +75 -0
- package/templates/django/project_name/urls.py +16 -0
- package/templates/django/project_name/wsgi.py +11 -0
- package/templates/django/pyproject.toml +20 -0
- package/templates/express-ts/README.md +27 -0
- package/templates/express-ts/_gitignore +7 -0
- package/templates/express-ts/_template.json +13 -0
- package/templates/express-ts/package.json +23 -0
- package/templates/express-ts/src/index.ts +17 -0
- package/templates/express-ts/src/middleware/error-handler.ts +14 -0
- package/templates/express-ts/src/routes/index.ts +11 -0
- package/templates/express-ts/tsconfig.json +17 -0
- package/templates/express-ts/tsup.config.ts +9 -0
- package/templates/fastapi/README.md +21 -0
- package/templates/fastapi/_gitignore +16 -0
- package/templates/fastapi/_template.json +14 -0
- package/templates/fastapi/pyproject.toml +21 -0
- package/templates/fastapi/src/project_name/__init__.py +1 -0
- package/templates/fastapi/src/project_name/main.py +20 -0
- package/templates/fastapi/src/project_name/routes/__init__.py +8 -0
- package/templates/flask/README.md +15 -0
- package/templates/flask/_gitignore +17 -0
- package/templates/flask/_template.json +14 -0
- package/templates/flask/pyproject.toml +19 -0
- package/templates/flask/src/project_name/__init__.py +1 -0
- package/templates/flask/src/project_name/app.py +15 -0
- package/templates/flask/src/project_name/routes/__init__.py +8 -0
- package/templates/fullstack-react-node/README.md +35 -0
- package/templates/fullstack-react-node/_gitignore +7 -0
- package/templates/fullstack-react-node/_template.json +14 -0
- package/templates/fullstack-react-node/backend/package.json +22 -0
- package/templates/fullstack-react-node/backend/src/index.ts +20 -0
- package/templates/fullstack-react-node/backend/tsconfig.json +17 -0
- package/templates/fullstack-react-node/backend/tsup.config.ts +9 -0
- package/templates/fullstack-react-node/frontend/index.html +12 -0
- package/templates/fullstack-react-node/frontend/package.json +22 -0
- package/templates/fullstack-react-node/frontend/src/App.css +16 -0
- package/templates/fullstack-react-node/frontend/src/App.tsx +22 -0
- package/templates/fullstack-react-node/frontend/src/main.tsx +9 -0
- package/templates/fullstack-react-node/frontend/tsconfig.json +20 -0
- package/templates/fullstack-react-node/frontend/vite.config.ts +14 -0
- package/templates/fullstack-react-node/package.json +10 -0
- package/templates/fullstack-react-node/pnpm-workspace.yaml +3 -0
- package/templates/fullstack-react-python/Makefile +35 -0
- package/templates/fullstack-react-python/README.md +43 -0
- package/templates/fullstack-react-python/_gitignore +18 -0
- package/templates/fullstack-react-python/_template.json +25 -0
- package/templates/fullstack-react-python/backend/pyproject.toml +21 -0
- package/templates/fullstack-react-python/backend/src/project_name/__init__.py +1 -0
- package/templates/fullstack-react-python/backend/src/project_name/main.py +29 -0
- package/templates/fullstack-react-python/backend/src/project_name/routes/__init__.py +8 -0
- package/templates/fullstack-react-python/frontend/index.html +12 -0
- package/templates/fullstack-react-python/frontend/package.json +22 -0
- package/templates/fullstack-react-python/frontend/src/App.css +16 -0
- package/templates/fullstack-react-python/frontend/src/App.tsx +22 -0
- package/templates/fullstack-react-python/frontend/src/main.tsx +9 -0
- package/templates/fullstack-react-python/frontend/tsconfig.json +20 -0
- package/templates/fullstack-react-python/frontend/vite.config.ts +14 -0
- package/templates/fullstack-vue-node/README.md +35 -0
- package/templates/fullstack-vue-node/_gitignore +7 -0
- package/templates/fullstack-vue-node/_template.json +14 -0
- package/templates/fullstack-vue-node/backend/package.json +22 -0
- package/templates/fullstack-vue-node/backend/src/index.ts +20 -0
- package/templates/fullstack-vue-node/backend/tsconfig.json +17 -0
- package/templates/fullstack-vue-node/backend/tsup.config.ts +9 -0
- package/templates/fullstack-vue-node/frontend/index.html +12 -0
- package/templates/fullstack-vue-node/frontend/package.json +20 -0
- package/templates/fullstack-vue-node/frontend/src/App.vue +41 -0
- package/templates/fullstack-vue-node/frontend/src/main.ts +4 -0
- package/templates/fullstack-vue-node/frontend/src/vite-env.d.ts +1 -0
- package/templates/fullstack-vue-node/frontend/tsconfig.json +20 -0
- package/templates/fullstack-vue-node/frontend/vite.config.ts +14 -0
- package/templates/fullstack-vue-node/package.json +10 -0
- package/templates/fullstack-vue-node/pnpm-workspace.yaml +3 -0
- package/templates/next-ts/README.md +26 -0
- package/templates/next-ts/_gitignore +34 -0
- package/templates/next-ts/_template.json +13 -0
- package/templates/next-ts/next.config.ts +7 -0
- package/templates/next-ts/package.json +22 -0
- package/templates/next-ts/src/app/globals.css +21 -0
- package/templates/next-ts/src/app/layout.tsx +19 -0
- package/templates/next-ts/src/app/page.tsx +10 -0
- package/templates/next-ts/tsconfig.json +27 -0
- package/templates/springboot/.mvn/wrapper/maven-wrapper.properties +2 -0
- package/templates/springboot/README.md +27 -0
- package/templates/springboot/_gitignore +36 -0
- package/templates/springboot/_template.json +14 -0
- package/templates/springboot/mvnw +19 -0
- package/templates/springboot/mvnw.cmd +13 -0
- package/templates/springboot/pom.xml +46 -0
- package/templates/springboot/src/main/java/com/example/project_name/Application.java +12 -0
- package/templates/springboot/src/main/java/com/example/project_name/controller/HelloController.java +25 -0
- package/templates/springboot/src/main/resources/application.yml +6 -0
- package/templates/springboot/src/test/java/com/example/project_name/ApplicationTests.java +12 -0
- package/templates/template.config.json +78 -10
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
FastAPI 项目
|
|
4
|
+
|
|
5
|
+
## 开发
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv run uvicorn {{projectName}}.main:app --reload
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 测试
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv run pytest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API 文档
|
|
18
|
+
|
|
19
|
+
启动服务后访问:
|
|
20
|
+
- Swagger UI: http://localhost:8000/docs
|
|
21
|
+
- ReDoc: http://localhost:8000/redoc
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "{{projectName}}"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "FastAPI project"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"fastapi>=0.115.0",
|
|
9
|
+
"uvicorn[standard]>=0.34.0",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["hatchling"]
|
|
14
|
+
build-backend = "hatchling.build"
|
|
15
|
+
|
|
16
|
+
[tool.uv]
|
|
17
|
+
dev-dependencies = [
|
|
18
|
+
"pytest>=8.0.0",
|
|
19
|
+
"httpx>=0.27.0",
|
|
20
|
+
"ruff>=0.8.0",
|
|
21
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""{{projectName}} - FastAPI application"""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from fastapi import FastAPI
|
|
2
|
+
from .routes import router
|
|
3
|
+
|
|
4
|
+
app = FastAPI(
|
|
5
|
+
title="{{projectName}}",
|
|
6
|
+
description="FastAPI application",
|
|
7
|
+
version="0.1.0"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
app.include_router(router, prefix="/api")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@app.get("/")
|
|
14
|
+
async def root():
|
|
15
|
+
return {"message": "Welcome to {{projectName}}"}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.get("/health")
|
|
19
|
+
async def health():
|
|
20
|
+
return {"status": "ok"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "{{projectName}}"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Flask project"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"flask>=3.0.0",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[build-system]
|
|
12
|
+
requires = ["hatchling"]
|
|
13
|
+
build-backend = "hatchling.build"
|
|
14
|
+
|
|
15
|
+
[tool.uv]
|
|
16
|
+
dev-dependencies = [
|
|
17
|
+
"pytest>=8.0.0",
|
|
18
|
+
"ruff>=0.8.0",
|
|
19
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""{{projectName}} - Flask application"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from flask import Flask
|
|
2
|
+
from .routes import bp
|
|
3
|
+
|
|
4
|
+
app = Flask(__name__)
|
|
5
|
+
app.register_blueprint(bp, url_prefix='/api')
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.route('/')
|
|
9
|
+
def index():
|
|
10
|
+
return {'message': 'Welcome to {{projectName}}'}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@app.route('/health')
|
|
14
|
+
def health():
|
|
15
|
+
return {'status': 'ok'}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
React + Node.js 全栈项目 (pnpm workspace)
|
|
4
|
+
|
|
5
|
+
## 项目结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
{{projectName}}/
|
|
9
|
+
├── frontend/ # React 前端 (Vite)
|
|
10
|
+
├── backend/ # Express 后端
|
|
11
|
+
└── package.json # Workspace 根配置
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 开发
|
|
15
|
+
|
|
16
|
+
同时启动前后端开发服务器:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- 前端: http://localhost:5173
|
|
23
|
+
- 后端: http://localhost:3001
|
|
24
|
+
|
|
25
|
+
## 构建
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 测试
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm test
|
|
35
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}-backend",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "tsx watch src/index.ts",
|
|
7
|
+
"build": "tsup",
|
|
8
|
+
"start": "node dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"cors": "^2.8.5",
|
|
12
|
+
"express": "^4.21.2"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/cors": "^2.8.17",
|
|
16
|
+
"@types/express": "^5.0.0",
|
|
17
|
+
"@types/node": "^22.10.7",
|
|
18
|
+
"tsup": "^8.3.5",
|
|
19
|
+
"tsx": "^4.19.2",
|
|
20
|
+
"typescript": "^5.7.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import express from 'express'
|
|
2
|
+
import cors from 'cors'
|
|
3
|
+
|
|
4
|
+
const app = express()
|
|
5
|
+
const PORT = process.env.PORT || 3001
|
|
6
|
+
|
|
7
|
+
app.use(cors())
|
|
8
|
+
app.use(express.json())
|
|
9
|
+
|
|
10
|
+
app.get('/api/health', (_req, res) => {
|
|
11
|
+
res.json({ status: 'ok' })
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
app.get('/api/hello', (_req, res) => {
|
|
15
|
+
res.json({ message: 'Hello from {{projectName}} backend!' })
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
app.listen(PORT, () => {
|
|
19
|
+
console.log(`Backend server is running on http://localhost:${PORT}`)
|
|
20
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"rootDir": "./src",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{projectName}}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}-frontend",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "^18.3.1",
|
|
13
|
+
"react-dom": "^18.3.1"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/react": "^18.3.18",
|
|
17
|
+
"@types/react-dom": "^18.3.5",
|
|
18
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
19
|
+
"typescript": "^5.7.3",
|
|
20
|
+
"vite": "^6.0.7"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
import './App.css'
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
const [message, setMessage] = useState<string>('')
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
fetch('/api/hello')
|
|
9
|
+
.then(res => res.json())
|
|
10
|
+
.then(data => setMessage(data.message))
|
|
11
|
+
.catch(err => console.error(err))
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="app">
|
|
16
|
+
<h1>{{projectName}}</h1>
|
|
17
|
+
<p>来自后端的消息: {message || '加载中...'}</p>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default App
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.PHONY: install dev build test clean
|
|
2
|
+
|
|
3
|
+
# 安装所有依赖
|
|
4
|
+
install:
|
|
5
|
+
cd frontend && pnpm install
|
|
6
|
+
cd backend && uv sync
|
|
7
|
+
|
|
8
|
+
# 开发模式(并行启动前后端)
|
|
9
|
+
dev:
|
|
10
|
+
@echo "Starting development servers..."
|
|
11
|
+
@(cd backend && uv run uvicorn {{projectName}}.main:app --reload --port 8000) & \
|
|
12
|
+
(cd frontend && pnpm dev) & \
|
|
13
|
+
wait
|
|
14
|
+
|
|
15
|
+
# 仅启动后端
|
|
16
|
+
dev-backend:
|
|
17
|
+
cd backend && uv run uvicorn {{projectName}}.main:app --reload --port 8000
|
|
18
|
+
|
|
19
|
+
# 仅启动前端
|
|
20
|
+
dev-frontend:
|
|
21
|
+
cd frontend && pnpm dev
|
|
22
|
+
|
|
23
|
+
# 构建
|
|
24
|
+
build:
|
|
25
|
+
cd frontend && pnpm build
|
|
26
|
+
|
|
27
|
+
# 测试
|
|
28
|
+
test:
|
|
29
|
+
cd backend && uv run pytest
|
|
30
|
+
cd frontend && pnpm test 2>/dev/null || true
|
|
31
|
+
|
|
32
|
+
# 清理
|
|
33
|
+
clean:
|
|
34
|
+
rm -rf frontend/node_modules frontend/dist
|
|
35
|
+
rm -rf backend/.venv backend/__pycache__
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
React + Python (FastAPI) 全栈项目
|
|
4
|
+
|
|
5
|
+
## 项目结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
{{projectName}}/
|
|
9
|
+
├── frontend/ # React 前端 (Vite + pnpm)
|
|
10
|
+
├── backend/ # FastAPI 后端 (uv)
|
|
11
|
+
├── Makefile # 统一命令入口
|
|
12
|
+
└── README.md
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 开发
|
|
16
|
+
|
|
17
|
+
同时启动前后端开发服务器:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
make dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- 前端: http://localhost:5173
|
|
24
|
+
- 后端: http://localhost:8000
|
|
25
|
+
- API 文档: http://localhost:8000/docs
|
|
26
|
+
|
|
27
|
+
## 安装依赖
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
make install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 构建
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
make build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 测试
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
make test
|
|
43
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "React + Python (FastAPI) 全栈项目模板",
|
|
3
|
+
"packageManager": "pnpm",
|
|
4
|
+
"type": "workspace",
|
|
5
|
+
"postInit": [
|
|
6
|
+
{
|
|
7
|
+
"command": "make install",
|
|
8
|
+
"description": "安装依赖"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"workspaces": [
|
|
12
|
+
{
|
|
13
|
+
"name": "frontend",
|
|
14
|
+
"packageManager": "pnpm"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "backend",
|
|
18
|
+
"packageManager": "uv"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"fileRenames": {
|
|
22
|
+
"_gitignore": ".gitignore",
|
|
23
|
+
"project_name": "{{projectName}}"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "{{projectName}}"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "FastAPI backend for {{projectName}}"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"fastapi>=0.115.0",
|
|
9
|
+
"uvicorn[standard]>=0.34.0",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["hatchling"]
|
|
14
|
+
build-backend = "hatchling.build"
|
|
15
|
+
|
|
16
|
+
[tool.uv]
|
|
17
|
+
dev-dependencies = [
|
|
18
|
+
"pytest>=8.0.0",
|
|
19
|
+
"httpx>=0.27.0",
|
|
20
|
+
"ruff>=0.8.0",
|
|
21
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""{{projectName}} - FastAPI backend"""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from fastapi import FastAPI
|
|
2
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
3
|
+
from .routes import router
|
|
4
|
+
|
|
5
|
+
app = FastAPI(
|
|
6
|
+
title="{{projectName}}",
|
|
7
|
+
description="FastAPI backend for {{projectName}}",
|
|
8
|
+
version="0.1.0"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
app.add_middleware(
|
|
12
|
+
CORSMiddleware,
|
|
13
|
+
allow_origins=["http://localhost:5173"],
|
|
14
|
+
allow_credentials=True,
|
|
15
|
+
allow_methods=["*"],
|
|
16
|
+
allow_headers=["*"],
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
app.include_router(router, prefix="/api")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@app.get("/")
|
|
23
|
+
async def root():
|
|
24
|
+
return {"message": "Welcome to {{projectName}} API"}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.get("/health")
|
|
28
|
+
async def health():
|
|
29
|
+
return {"status": "ok"}
|