feat: универсальный шаблон проектов контура Raisa

- base_templates/: шаблоны платформы fastapi, streamlit, airflow без изменений
- contour/: платформа, подтверждённые версии, грабли, профили 4 типов приложений
- project-kit/: SDD (S/M/L, delta/spec/plan, constitution, DoR/DoD) + grill,
  критик тестов, UX gate, handoff; один канон AGENTS.md для Cursor и Claude Code
- scripts/init_project.sh: сборка нового проекта или подключение kit к существующему
- docs/decisions/0001: что перенесено из elite_vibecoding и dmukp и почему

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139EkK4ShEj52pM9Z5UCwM1
This commit is contained in:
2026-11-09 17:44:48 +03:00
parent 66a2c6b487
commit 13d4be5464
105 changed files with 2548 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
from .app import app
from .conf import get_settings
__all__ = [
"app",
"get_settings"
]

View File

@@ -0,0 +1,50 @@
import os
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from datetime import datetime, timezone
from .conf import get_settings
from .routes import api_route
settings = get_settings()
VERSION = "1.0.0"
UP_TIME = datetime.now(timezone.utc)
app = FastAPI(
title="Fast API",
version=VERSION,
root_path=settings.ROOT_PATH,
)
@app.get(
"/healthcheck",
status_code=200
)
async def healthcheck():
return {
"uptime": UP_TIME,
"version": VERSION
}
app.add_middleware(ProxyHeadersMiddleware, trusted_hosts=["*"])
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
#Создание каталога для web приложения
os.makedirs(os.path.join('web'), exist_ok=True)
#Подключаем все ендпоинты и роуты до маунта статических файлов
app.include_router(api_route)
#Подключение собранного web приложения
app.mount("/", StaticFiles(directory="web", html=True), name="web")

View File

@@ -0,0 +1,5 @@
from .settings import get_settings
__all__ = [
"get_settings"
]

View File

@@ -0,0 +1,9 @@
from pydantic import BaseModel
class ServerSettings(BaseModel):
"""
Настройки сервера uvicorn
"""
HOST: str = '0.0.0.0'
PORT: int = 8000

View File

@@ -0,0 +1,33 @@
from fastapi.logger import logger
from pydantic_settings import BaseSettings
from dotenv import load_dotenv
from .models import ServerSettings
from functools import lru_cache
class Settings(BaseSettings):
""" Настройки приложения """
ROOT_PATH: str = '/'
server: ServerSettings = ServerSettings()
class Config:
extra = 'ignore'
env_file = ".env"
env_nested_delimiter = '__'
nested_model_default_partial_update = False
@lru_cache
def get_settings() -> Settings:
"""
Получение настроек приложения
:return: Настройки приложения
"""
try:
_ = load_dotenv()
except Exception as err:
logger.error("Error load settings", exc_info=err)
return Settings()

View File

@@ -0,0 +1,5 @@
from .api import api_route
__all__ = [
"api_route"
]

View File

@@ -0,0 +1,5 @@
from .route import route as api_route
__all__ = [
"api_route"
]

View File

@@ -0,0 +1,17 @@
from fastapi import APIRouter
from datetime import datetime, timezone
from .schemas import ApiResponse
route = APIRouter(prefix="/api",tags=['Base'])
@route.get(
"",
response_model=ApiResponse
)
async def get_data():
return ApiResponse(
date_with_time=datetime.now(timezone.utc),
text="Fast API приложение"
)

View File

@@ -0,0 +1,7 @@
from pydantic import BaseModel
from datetime import datetime
class ApiResponse(BaseModel):
date_with_time: datetime
text: str