fastapi-fullstack 0.1.2__py3-none-any.whl
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.
- fastapi_fullstack-0.1.2.dist-info/METADATA +545 -0
- fastapi_fullstack-0.1.2.dist-info/RECORD +221 -0
- fastapi_fullstack-0.1.2.dist-info/WHEEL +4 -0
- fastapi_fullstack-0.1.2.dist-info/entry_points.txt +2 -0
- fastapi_fullstack-0.1.2.dist-info/licenses/LICENSE +21 -0
- fastapi_gen/__init__.py +3 -0
- fastapi_gen/cli.py +256 -0
- fastapi_gen/config.py +255 -0
- fastapi_gen/generator.py +181 -0
- fastapi_gen/prompts.py +648 -0
- fastapi_gen/template/cookiecutter.json +76 -0
- fastapi_gen/template/hooks/post_gen_project.py +111 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.env.example +136 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +150 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.gitignore +108 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/CLAUDE.md +357 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/Makefile +298 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/README.md +723 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.dockerignore +60 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.pre-commit-config.yaml +32 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/Dockerfile +56 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/env.py +76 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/script.py.mako +30 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/versions/.gitkeep +0 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic.ini +48 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/__init__.py +3 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/admin.py +115 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/__init__.py +13 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/assistant.py +202 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/__init__.py +13 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/datetime_tool.py +17 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/__init__.py +1 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/deps.py +528 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/exception_handlers.py +85 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/router.py +10 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/__init__.py +9 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/__init__.py +87 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/agent.py +448 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/auth.py +395 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/conversations.py +490 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/health.py +227 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/items.py +275 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/oauth.py +205 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/sessions.py +168 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/users.py +333 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/webhooks.py +477 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/ws.py +46 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/versioning.py +221 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/__init__.py +14 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/redis.py +88 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/__init__.py +117 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/cleanup.py +75 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/example.py +28 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/seed.py +266 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/__init__.py +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/cache.py +23 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/config.py +247 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/csrf.py +153 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/exceptions.py +122 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/logfire_setup.py +101 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/middleware.py +99 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/oauth.py +23 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/rate_limit.py +58 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/sanitize.py +271 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/security.py +102 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/__init__.py +7 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/base.py +41 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/__init__.py +31 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/conversation.py +319 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/item.py +96 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/session.py +126 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/user.py +218 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/webhook.py +244 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/session.py +113 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/main.py +326 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/pipelines/__init__.py +9 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/pipelines/base.py +73 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/__init__.py +49 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/base.py +154 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/conversation.py +760 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/item.py +222 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/session.py +318 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/user.py +322 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/webhook.py +358 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/__init__.py +50 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/base.py +57 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/conversation.py +195 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/item.py +52 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/session.py +42 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/token.py +31 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/user.py +64 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/webhook.py +89 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/__init__.py +38 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/conversation.py +797 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/item.py +246 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/session.py +333 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/user.py +432 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/webhook.py +561 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/__init__.py +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/celery_app.py +64 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/taskiq_app.py +38 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/__init__.py +25 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/examples.py +106 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/schedules.py +29 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/taskiq_examples.py +92 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/__init__.py +1 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/commands.py +438 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/pyproject.toml +158 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/scripts/.gitkeep +0 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/__init__.py +1 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/__init__.py +1 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_auth.py +242 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_exceptions.py +151 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_health.py +113 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_items.py +310 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_users.py +253 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/conftest.py +151 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_agents.py +121 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_clients.py +183 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_commands.py +173 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_core.py +143 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_pipelines.py +118 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_repositories.py +181 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_security.py +124 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_services.py +363 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_worker.py +85 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.dev.yml +242 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.frontend.yml +31 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.prod.yml +382 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.yml +241 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.env.example +12 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.gitignore +45 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.prettierignore +19 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.prettierrc +11 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/Dockerfile +44 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/README.md +693 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/auth.setup.ts +49 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/auth.spec.ts +134 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/chat.spec.ts +207 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/home.spec.ts +73 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/instrumentation.ts +14 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/messages/en.json +84 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/messages/pl.json +84 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/next.config.ts +76 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/package.json +66 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/playwright.config.ts +101 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/postcss.config.mjs +7 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(auth)/layout.tsx +11 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(auth)/login/page.tsx +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(auth)/register/page.tsx +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(dashboard)/chat/page.tsx +20 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(dashboard)/dashboard/page.tsx +99 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(dashboard)/layout.tsx +17 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/(dashboard)/profile/page.tsx +156 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/login/route.ts +58 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/logout/route.ts +24 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/me/route.ts +39 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/oauth-callback/route.ts +50 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/refresh/route.ts +54 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/register/route.ts +26 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/[id]/messages/route.ts +41 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/[id]/route.ts +108 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/route.ts +73 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/health/route.ts +21 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/auth/callback/page.tsx +96 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/globals.css +108 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/layout.tsx +25 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/page.tsx +73 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/providers.tsx +29 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/index.ts +2 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/login-form.tsx +120 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/register-form.tsx +153 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/chat-container.tsx +135 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/chat-input.tsx +73 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/conversation-sidebar.tsx +261 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/index.ts +8 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/message-item.tsx +63 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/message-list.tsx +18 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/tool-call-card.tsx +60 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/icons/google-icon.tsx +32 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/icons/index.ts +3 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/language-switcher.tsx +97 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/header.tsx +45 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/index.ts +2 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/sidebar.tsx +48 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/index.ts +7 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/theme-provider.tsx +53 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/theme-toggle.tsx +83 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/badge.tsx +35 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/button.test.tsx +75 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/button.tsx +54 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/card.tsx +82 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/index.ts +12 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/input.tsx +21 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/label.tsx +21 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/index.ts +6 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-auth.ts +97 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-chat.ts +203 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-conversations.ts +175 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-websocket.ts +105 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/i18n.ts +32 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/api-client.ts +90 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/constants.ts +39 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/server-api.ts +78 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/utils.test.ts +44 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/utils.ts +44 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/middleware.ts +33 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/auth-store.test.ts +72 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/auth-store.ts +48 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/chat-store.ts +65 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/conversation-store.ts +76 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/index.ts +6 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/theme-store.ts +44 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/api.ts +27 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/auth.ts +52 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/chat.ts +81 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/conversation.ts +49 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/index.ts +10 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/tsconfig.json +28 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/vitest.config.ts +36 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/vitest.setup.ts +56 -0
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
# {{ cookiecutter.project_name }}
|
|
2
|
+
|
|
3
|
+
{{ cookiecutter.project_description }}
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue?logo=python&logoColor=white" alt="Python">
|
|
7
|
+
<img src="https://img.shields.io/badge/FastAPI-0.115-009688?logo=fastapi&logoColor=white" alt="FastAPI">
|
|
8
|
+
{%- if cookiecutter.use_frontend %}
|
|
9
|
+
<img src="https://img.shields.io/badge/Next.js-15-black?logo=next.js&logoColor=white" alt="Next.js">
|
|
10
|
+
{%- endif %}
|
|
11
|
+
{%- if cookiecutter.use_postgresql %}
|
|
12
|
+
<img src="https://img.shields.io/badge/PostgreSQL-16-336791?logo=postgresql&logoColor=white" alt="PostgreSQL">
|
|
13
|
+
{%- endif %}
|
|
14
|
+
{%- if cookiecutter.use_mongodb %}
|
|
15
|
+
<img src="https://img.shields.io/badge/MongoDB-7-47A248?logo=mongodb&logoColor=white" alt="MongoDB">
|
|
16
|
+
{%- endif %}
|
|
17
|
+
{%- if cookiecutter.enable_redis %}
|
|
18
|
+
<img src="https://img.shields.io/badge/Redis-7-DC382D?logo=redis&logoColor=white" alt="Redis">
|
|
19
|
+
{%- endif %}
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<sub>Generated with <a href="https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template">Full-Stack FastAPI + Next.js Template</a></sub>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
31
|
+
- 🤖 **AI Agent** - PydanticAI with WebSocket streaming
|
|
32
|
+
{%- endif %}
|
|
33
|
+
{%- if cookiecutter.use_jwt %}
|
|
34
|
+
- 🔐 **JWT Authentication** - Access + Refresh tokens
|
|
35
|
+
{%- endif %}
|
|
36
|
+
{%- if cookiecutter.use_api_key %}
|
|
37
|
+
- 🔑 **API Key Auth** - Header-based authentication
|
|
38
|
+
{%- endif %}
|
|
39
|
+
{%- if cookiecutter.enable_oauth %}
|
|
40
|
+
- 🌐 **OAuth2** - Social login (Google)
|
|
41
|
+
{%- endif %}
|
|
42
|
+
{%- if cookiecutter.use_postgresql %}
|
|
43
|
+
- 🐘 **PostgreSQL** - Async with SQLAlchemy 2.0
|
|
44
|
+
{%- endif %}
|
|
45
|
+
{%- if cookiecutter.use_mongodb %}
|
|
46
|
+
- 🍃 **MongoDB** - Async with Motor
|
|
47
|
+
{%- endif %}
|
|
48
|
+
{%- if cookiecutter.enable_redis %}
|
|
49
|
+
- 📦 **Redis** - Caching and sessions
|
|
50
|
+
{%- endif %}
|
|
51
|
+
{%- if cookiecutter.use_celery %}
|
|
52
|
+
- 🥬 **Celery** - Background task processing
|
|
53
|
+
{%- endif %}
|
|
54
|
+
{%- if cookiecutter.use_taskiq %}
|
|
55
|
+
- ⚡ **Taskiq** - Async task queue
|
|
56
|
+
{%- endif %}
|
|
57
|
+
{%- if cookiecutter.enable_rate_limiting %}
|
|
58
|
+
- 🚦 **Rate Limiting** - Request throttling
|
|
59
|
+
{%- endif %}
|
|
60
|
+
{%- if cookiecutter.enable_admin_panel %}
|
|
61
|
+
- 🗄️ **Admin Panel** - SQLAdmin UI
|
|
62
|
+
{%- endif %}
|
|
63
|
+
{%- if cookiecutter.enable_logfire %}
|
|
64
|
+
- 📊 **Logfire** - Full-stack observability (see [Logfire section](#logfire-observability))
|
|
65
|
+
{%- endif %}
|
|
66
|
+
{%- if cookiecutter.enable_sentry %}
|
|
67
|
+
- 🛡️ **Sentry** - Error tracking
|
|
68
|
+
{%- endif %}
|
|
69
|
+
{%- if cookiecutter.use_frontend %}
|
|
70
|
+
- 🎨 **Next.js 15** - React 19 + TypeScript + Tailwind
|
|
71
|
+
{%- endif %}
|
|
72
|
+
{%- if cookiecutter.enable_docker %}
|
|
73
|
+
- 🐳 **Docker** - Containerized development
|
|
74
|
+
{%- endif %}
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
### Prerequisites
|
|
81
|
+
|
|
82
|
+
- Python 3.11+ ([uv](https://docs.astral.sh/uv/) recommended)
|
|
83
|
+
{%- if cookiecutter.use_frontend %}
|
|
84
|
+
- [Bun](https://bun.sh) (for frontend)
|
|
85
|
+
{%- endif %}
|
|
86
|
+
{%- if cookiecutter.enable_docker %}
|
|
87
|
+
- Docker & Docker Compose
|
|
88
|
+
{%- endif %}
|
|
89
|
+
|
|
90
|
+
### 1. Setup Backend
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
cd backend
|
|
94
|
+
|
|
95
|
+
# Install dependencies
|
|
96
|
+
uv sync
|
|
97
|
+
|
|
98
|
+
# Configure environment
|
|
99
|
+
cp .env.example .env
|
|
100
|
+
# Edit .env with your settings
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
{%- if cookiecutter.use_postgresql %}
|
|
104
|
+
|
|
105
|
+
### 2. Start PostgreSQL
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Using Docker (recommended)
|
|
109
|
+
docker run -d \
|
|
110
|
+
--name {{ cookiecutter.project_slug }}-db \
|
|
111
|
+
-e POSTGRES_PASSWORD=secret \
|
|
112
|
+
-e POSTGRES_DB={{ cookiecutter.project_slug }} \
|
|
113
|
+
-p 5432:5432 \
|
|
114
|
+
postgres:16-alpine
|
|
115
|
+
|
|
116
|
+
# Or use existing PostgreSQL - update .env accordingly
|
|
117
|
+
```
|
|
118
|
+
{%- endif %}
|
|
119
|
+
|
|
120
|
+
{%- if cookiecutter.enable_redis %}
|
|
121
|
+
|
|
122
|
+
### {% if cookiecutter.use_postgresql %}3{% else %}2{% endif %}. Start Redis
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
docker run -d \
|
|
126
|
+
--name {{ cookiecutter.project_slug }}-redis \
|
|
127
|
+
-p 6379:6379 \
|
|
128
|
+
redis:7-alpine
|
|
129
|
+
```
|
|
130
|
+
{%- endif %}
|
|
131
|
+
|
|
132
|
+
{%- if cookiecutter.use_postgresql or cookiecutter.use_sqlite %}
|
|
133
|
+
|
|
134
|
+
### {% if cookiecutter.enable_redis %}4{% elif cookiecutter.use_postgresql %}3{% else %}2{% endif %}. Initialize Database
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
cd backend
|
|
138
|
+
|
|
139
|
+
# Run migrations
|
|
140
|
+
uv run alembic upgrade head
|
|
141
|
+
{%- if cookiecutter.use_jwt %}
|
|
142
|
+
|
|
143
|
+
# Create admin user
|
|
144
|
+
uv run {{ cookiecutter.project_slug }} user create-admin --email admin@example.com
|
|
145
|
+
{%- endif %}
|
|
146
|
+
```
|
|
147
|
+
{%- endif %}
|
|
148
|
+
|
|
149
|
+
### {% if cookiecutter.use_postgresql and cookiecutter.enable_redis %}5{% elif cookiecutter.use_postgresql or cookiecutter.enable_redis %}4{% elif cookiecutter.use_sqlite %}3{% else %}2{% endif %}. Run Development Server
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
cd backend
|
|
153
|
+
uv run uvicorn app.main:app --reload --port {{ cookiecutter.backend_port }}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
{%- if cookiecutter.use_frontend %}
|
|
157
|
+
|
|
158
|
+
### {% if cookiecutter.use_postgresql and cookiecutter.enable_redis %}6{% elif cookiecutter.use_postgresql or cookiecutter.enable_redis %}5{% elif cookiecutter.use_sqlite %}4{% else %}3{% endif %}. Setup Frontend
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
cd frontend
|
|
162
|
+
bun install
|
|
163
|
+
bun dev
|
|
164
|
+
```
|
|
165
|
+
{%- endif %}
|
|
166
|
+
|
|
167
|
+
### Access Points
|
|
168
|
+
|
|
169
|
+
| Service | URL |
|
|
170
|
+
|---------|-----|
|
|
171
|
+
| API | http://localhost:{{ cookiecutter.backend_port }} |
|
|
172
|
+
| API Docs (Swagger) | http://localhost:{{ cookiecutter.backend_port }}/docs |
|
|
173
|
+
| API Docs (ReDoc) | http://localhost:{{ cookiecutter.backend_port }}/redoc |
|
|
174
|
+
{%- if cookiecutter.enable_admin_panel %}
|
|
175
|
+
| Admin Panel | http://localhost:{{ cookiecutter.backend_port }}/admin |
|
|
176
|
+
{%- endif %}
|
|
177
|
+
{%- if cookiecutter.use_frontend %}
|
|
178
|
+
| Frontend | http://localhost:{{ cookiecutter.frontend_port }} |
|
|
179
|
+
{%- endif %}
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
{%- if cookiecutter.enable_docker %}
|
|
184
|
+
|
|
185
|
+
## Docker Development
|
|
186
|
+
|
|
187
|
+
### Start All Services
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Development mode
|
|
191
|
+
docker compose up -d
|
|
192
|
+
|
|
193
|
+
# Production mode
|
|
194
|
+
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
|
195
|
+
|
|
196
|
+
# View logs
|
|
197
|
+
docker compose logs -f
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Services Started
|
|
201
|
+
|
|
202
|
+
| Service | Description |
|
|
203
|
+
|---------|-------------|
|
|
204
|
+
| `backend` | FastAPI application |
|
|
205
|
+
{%- if cookiecutter.use_postgresql %}
|
|
206
|
+
| `db` | PostgreSQL database |
|
|
207
|
+
{%- endif %}
|
|
208
|
+
{%- if cookiecutter.enable_redis %}
|
|
209
|
+
| `redis` | Redis cache |
|
|
210
|
+
{%- endif %}
|
|
211
|
+
{%- if cookiecutter.use_celery %}
|
|
212
|
+
| `celery-worker` | Celery worker |
|
|
213
|
+
| `celery-beat` | Celery scheduler |
|
|
214
|
+
| `flower` | Celery monitoring (port 5555) |
|
|
215
|
+
{%- endif %}
|
|
216
|
+
{%- if cookiecutter.use_taskiq %}
|
|
217
|
+
| `taskiq-worker` | Taskiq worker |
|
|
218
|
+
{%- endif %}
|
|
219
|
+
{%- if cookiecutter.use_frontend %}
|
|
220
|
+
| `frontend` | Next.js application |
|
|
221
|
+
{%- endif %}
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
{%- endif %}
|
|
225
|
+
|
|
226
|
+
## Project CLI
|
|
227
|
+
|
|
228
|
+
This project includes a Django-style CLI for common tasks:
|
|
229
|
+
|
|
230
|
+
### Server Commands
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Start development server
|
|
234
|
+
{{ cookiecutter.project_slug }} server run --reload
|
|
235
|
+
|
|
236
|
+
# Show all registered routes
|
|
237
|
+
{{ cookiecutter.project_slug }} server routes
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
{%- if cookiecutter.use_postgresql or cookiecutter.use_sqlite %}
|
|
241
|
+
|
|
242
|
+
### Database Commands
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Initialize database (run all migrations)
|
|
246
|
+
{{ cookiecutter.project_slug }} db init
|
|
247
|
+
|
|
248
|
+
# Create new migration
|
|
249
|
+
{{ cookiecutter.project_slug }} db migrate -m "Add new table"
|
|
250
|
+
|
|
251
|
+
# Apply pending migrations
|
|
252
|
+
{{ cookiecutter.project_slug }} db upgrade
|
|
253
|
+
|
|
254
|
+
# Rollback last migration
|
|
255
|
+
{{ cookiecutter.project_slug }} db downgrade
|
|
256
|
+
|
|
257
|
+
# Show current revision
|
|
258
|
+
{{ cookiecutter.project_slug }} db current
|
|
259
|
+
```
|
|
260
|
+
{%- endif %}
|
|
261
|
+
|
|
262
|
+
{%- if cookiecutter.use_jwt %}
|
|
263
|
+
|
|
264
|
+
### User Management
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Create user (interactive)
|
|
268
|
+
{{ cookiecutter.project_slug }} user create
|
|
269
|
+
|
|
270
|
+
# Create admin user
|
|
271
|
+
{{ cookiecutter.project_slug }} user create-admin --email admin@example.com
|
|
272
|
+
|
|
273
|
+
# List all users
|
|
274
|
+
{{ cookiecutter.project_slug }} user list
|
|
275
|
+
|
|
276
|
+
# Change user role
|
|
277
|
+
{{ cookiecutter.project_slug }} user set-role user@example.com --role admin
|
|
278
|
+
```
|
|
279
|
+
{%- endif %}
|
|
280
|
+
|
|
281
|
+
{%- if cookiecutter.use_celery %}
|
|
282
|
+
|
|
283
|
+
### Celery Commands
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Start worker
|
|
287
|
+
{{ cookiecutter.project_slug }} celery worker
|
|
288
|
+
|
|
289
|
+
# Start beat scheduler
|
|
290
|
+
{{ cookiecutter.project_slug }} celery beat
|
|
291
|
+
|
|
292
|
+
# Start Flower monitoring
|
|
293
|
+
{{ cookiecutter.project_slug }} celery flower
|
|
294
|
+
```
|
|
295
|
+
{%- endif %}
|
|
296
|
+
|
|
297
|
+
{%- if cookiecutter.use_taskiq %}
|
|
298
|
+
|
|
299
|
+
### Taskiq Commands
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Start worker
|
|
303
|
+
{{ cookiecutter.project_slug }} taskiq worker
|
|
304
|
+
|
|
305
|
+
# Start scheduler
|
|
306
|
+
{{ cookiecutter.project_slug }} taskiq scheduler
|
|
307
|
+
```
|
|
308
|
+
{%- endif %}
|
|
309
|
+
|
|
310
|
+
### Custom Commands
|
|
311
|
+
|
|
312
|
+
Create your own commands in `app/commands/`:
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
# app/commands/seed.py
|
|
316
|
+
from app.commands import command, success
|
|
317
|
+
import click
|
|
318
|
+
|
|
319
|
+
@command("seed", help="Seed database with test data")
|
|
320
|
+
@click.option("--count", "-c", default=10, type=int)
|
|
321
|
+
def seed_database(count: int):
|
|
322
|
+
# Your seeding logic here
|
|
323
|
+
success(f"Created {count} records!")
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Run custom command
|
|
328
|
+
{{ cookiecutter.project_slug }} cmd seed --count 100
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
> **Note:** Commands are auto-discovered from `app/commands/`. Just create a file with the `@command` decorator.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Makefile Commands
|
|
336
|
+
|
|
337
|
+
| Command | Description |
|
|
338
|
+
|---------|-------------|
|
|
339
|
+
| `make install` | Install dependencies |
|
|
340
|
+
| `make run` | Start dev server with hot reload |
|
|
341
|
+
| `make test` | Run tests |
|
|
342
|
+
| `make test-cov` | Run tests with coverage |
|
|
343
|
+
| `make lint` | Check code with ruff |
|
|
344
|
+
| `make format` | Format code with ruff |
|
|
345
|
+
| `make typecheck` | Run mypy type checking |
|
|
346
|
+
{%- if cookiecutter.use_postgresql or cookiecutter.use_sqlite %}
|
|
347
|
+
| `make db-migrate` | Create new migration |
|
|
348
|
+
| `make db-upgrade` | Apply migrations |
|
|
349
|
+
| `make db-downgrade` | Rollback migration |
|
|
350
|
+
{%- endif %}
|
|
351
|
+
{%- if cookiecutter.enable_docker %}
|
|
352
|
+
| `make docker-up` | Start all Docker services |
|
|
353
|
+
| `make docker-down` | Stop all Docker services |
|
|
354
|
+
| `make docker-logs` | View Docker logs |
|
|
355
|
+
{%- endif %}
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Project Structure
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
{{ cookiecutter.project_slug }}/
|
|
363
|
+
├── backend/
|
|
364
|
+
│ ├── app/
|
|
365
|
+
│ │ ├── main.py # FastAPI app with lifespan
|
|
366
|
+
│ │ ├── api/
|
|
367
|
+
│ │ │ ├── routes/v1/ # API endpoints
|
|
368
|
+
│ │ │ ├── deps.py # Dependency injection
|
|
369
|
+
│ │ │ └── router.py # Route aggregation
|
|
370
|
+
│ │ ├── core/
|
|
371
|
+
│ │ │ ├── config.py # Settings (pydantic-settings)
|
|
372
|
+
{%- if cookiecutter.use_auth %}
|
|
373
|
+
│ │ │ ├── security.py # Auth utilities
|
|
374
|
+
{%- endif %}
|
|
375
|
+
{%- if cookiecutter.enable_logfire %}
|
|
376
|
+
│ │ │ └── logfire_setup.py # Observability
|
|
377
|
+
{%- endif %}
|
|
378
|
+
│ │ ├── db/
|
|
379
|
+
│ │ │ ├── models/ # Database models
|
|
380
|
+
│ │ │ └── session.py # Connection management
|
|
381
|
+
│ │ ├── schemas/ # Pydantic schemas
|
|
382
|
+
│ │ ├── repositories/ # Data access layer
|
|
383
|
+
│ │ ├── services/ # Business logic
|
|
384
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
385
|
+
│ │ ├── agents/ # PydanticAI agents
|
|
386
|
+
{%- endif %}
|
|
387
|
+
│ │ ├── commands/ # Custom CLI commands
|
|
388
|
+
{%- if cookiecutter.use_celery or cookiecutter.use_taskiq %}
|
|
389
|
+
│ │ └── worker/ # Background tasks
|
|
390
|
+
{%- endif %}
|
|
391
|
+
│ ├── cli/ # Project CLI
|
|
392
|
+
│ ├── tests/ # Test suite
|
|
393
|
+
{%- if cookiecutter.use_postgresql or cookiecutter.use_sqlite %}
|
|
394
|
+
│ └── alembic/ # Database migrations
|
|
395
|
+
{%- endif %}
|
|
396
|
+
{%- if cookiecutter.use_frontend %}
|
|
397
|
+
├── frontend/
|
|
398
|
+
│ ├── src/
|
|
399
|
+
│ │ ├── app/ # Next.js App Router
|
|
400
|
+
│ │ ├── components/ # React components
|
|
401
|
+
│ │ ├── hooks/ # Custom hooks
|
|
402
|
+
│ │ ├── stores/ # Zustand stores
|
|
403
|
+
│ │ └── lib/ # Utilities
|
|
404
|
+
│ └── e2e/ # Playwright tests
|
|
405
|
+
{%- endif %}
|
|
406
|
+
{%- if cookiecutter.enable_docker %}
|
|
407
|
+
├── docker-compose.yml
|
|
408
|
+
├── docker-compose.prod.yml
|
|
409
|
+
{%- endif %}
|
|
410
|
+
├── Makefile
|
|
411
|
+
└── README.md
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Architecture
|
|
417
|
+
|
|
418
|
+
This project follows a **Repository + Service** pattern:
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
API Routes → Services → Repositories → Database
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
| Layer | Location | Responsibility |
|
|
425
|
+
|-------|----------|----------------|
|
|
426
|
+
| **Routes** | `app/api/routes/` | HTTP handling, validation |
|
|
427
|
+
| **Services** | `app/services/` | Business logic |
|
|
428
|
+
| **Repositories** | `app/repositories/` | Data access |
|
|
429
|
+
| **Schemas** | `app/schemas/` | Request/Response models |
|
|
430
|
+
| **Models** | `app/db/models/` | Database models |
|
|
431
|
+
|
|
432
|
+
> 📚 For detailed architecture documentation, see the [template repository](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md).
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## Configuration
|
|
437
|
+
|
|
438
|
+
All configuration via environment variables in `.env`:
|
|
439
|
+
|
|
440
|
+
### Core Settings
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
ENVIRONMENT=local # local, staging, production
|
|
444
|
+
DEBUG=true
|
|
445
|
+
PROJECT_NAME={{ cookiecutter.project_name }}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
{%- if cookiecutter.use_postgresql %}
|
|
449
|
+
|
|
450
|
+
### Database (PostgreSQL)
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
POSTGRES_HOST=localhost
|
|
454
|
+
POSTGRES_PORT=5432
|
|
455
|
+
POSTGRES_USER=postgres
|
|
456
|
+
POSTGRES_PASSWORD=secret
|
|
457
|
+
POSTGRES_DB={{ cookiecutter.project_slug }}
|
|
458
|
+
|
|
459
|
+
# Pool settings
|
|
460
|
+
DB_POOL_SIZE={{ cookiecutter.db_pool_size }}
|
|
461
|
+
DB_MAX_OVERFLOW={{ cookiecutter.db_max_overflow }}
|
|
462
|
+
```
|
|
463
|
+
{%- endif %}
|
|
464
|
+
|
|
465
|
+
{%- if cookiecutter.use_mongodb %}
|
|
466
|
+
|
|
467
|
+
### Database (MongoDB)
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
MONGO_HOST=localhost
|
|
471
|
+
MONGO_PORT=27017
|
|
472
|
+
MONGO_DB={{ cookiecutter.project_slug }}
|
|
473
|
+
MONGO_USER=
|
|
474
|
+
MONGO_PASSWORD=
|
|
475
|
+
```
|
|
476
|
+
{%- endif %}
|
|
477
|
+
|
|
478
|
+
{%- if cookiecutter.use_jwt %}
|
|
479
|
+
|
|
480
|
+
### Authentication
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
# Generate with: openssl rand -hex 32
|
|
484
|
+
SECRET_KEY=change-me-in-production
|
|
485
|
+
|
|
486
|
+
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
|
487
|
+
REFRESH_TOKEN_EXPIRE_MINUTES=10080 # 7 days
|
|
488
|
+
```
|
|
489
|
+
{%- endif %}
|
|
490
|
+
|
|
491
|
+
{%- if cookiecutter.enable_redis %}
|
|
492
|
+
|
|
493
|
+
### Redis
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
REDIS_HOST=localhost
|
|
497
|
+
REDIS_PORT=6379
|
|
498
|
+
REDIS_PASSWORD=
|
|
499
|
+
```
|
|
500
|
+
{%- endif %}
|
|
501
|
+
|
|
502
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
503
|
+
|
|
504
|
+
### AI Agent
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
OPENAI_API_KEY=sk-...
|
|
508
|
+
AI_MODEL=gpt-4o-mini
|
|
509
|
+
AI_TEMPERATURE=0.7
|
|
510
|
+
```
|
|
511
|
+
{%- endif %}
|
|
512
|
+
|
|
513
|
+
{%- if cookiecutter.enable_logfire %}
|
|
514
|
+
|
|
515
|
+
### Logfire
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
# Get token at https://logfire.pydantic.dev
|
|
519
|
+
LOGFIRE_TOKEN=your-token
|
|
520
|
+
LOGFIRE_SERVICE_NAME={{ cookiecutter.project_slug }}
|
|
521
|
+
```
|
|
522
|
+
{%- endif %}
|
|
523
|
+
|
|
524
|
+
{%- if cookiecutter.enable_sentry %}
|
|
525
|
+
|
|
526
|
+
### Sentry
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
SENTRY_DSN=https://xxx@sentry.io/xxx
|
|
530
|
+
```
|
|
531
|
+
{%- endif %}
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
{%- if cookiecutter.enable_logfire %}
|
|
535
|
+
|
|
536
|
+
## Logfire Observability
|
|
537
|
+
|
|
538
|
+
[Logfire](https://logfire.pydantic.dev) provides complete observability for your application. Built by the Pydantic team, it offers first-class support for the Python ecosystem.
|
|
539
|
+
|
|
540
|
+
### What Gets Instrumented
|
|
541
|
+
|
|
542
|
+
| Component | What You See |
|
|
543
|
+
|-----------|-------------|
|
|
544
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
545
|
+
| **PydanticAI** | Agent runs, tool calls, LLM requests, token usage |
|
|
546
|
+
{%- endif %}
|
|
547
|
+
| **FastAPI** | Request/response traces, latency, status codes |
|
|
548
|
+
{%- if cookiecutter.use_postgresql %}
|
|
549
|
+
| **PostgreSQL** | Query execution time, slow queries, connection pool |
|
|
550
|
+
{%- endif %}
|
|
551
|
+
{%- if cookiecutter.use_mongodb %}
|
|
552
|
+
| **MongoDB** | Collection operations, query filters, execution time |
|
|
553
|
+
{%- endif %}
|
|
554
|
+
{%- if cookiecutter.enable_redis %}
|
|
555
|
+
| **Redis** | Cache hits/misses, command latency, key patterns |
|
|
556
|
+
{%- endif %}
|
|
557
|
+
{%- if cookiecutter.use_celery %}
|
|
558
|
+
| **Celery** | Task execution, queue depth, worker performance |
|
|
559
|
+
{%- endif %}
|
|
560
|
+
{%- if cookiecutter.logfire_httpx %}
|
|
561
|
+
| **HTTPX** | External API calls, response times, error rates |
|
|
562
|
+
{%- endif %}
|
|
563
|
+
|
|
564
|
+
### Custom Instrumentation
|
|
565
|
+
|
|
566
|
+
```python
|
|
567
|
+
import logfire
|
|
568
|
+
|
|
569
|
+
# Manual spans for important operations
|
|
570
|
+
with logfire.span("process_order", order_id=str(order.id)):
|
|
571
|
+
await validate_order(order)
|
|
572
|
+
await charge_payment(order)
|
|
573
|
+
await send_confirmation(order)
|
|
574
|
+
|
|
575
|
+
# Structured logging
|
|
576
|
+
logfire.info("User registered", user_id=user.id, email=user.email)
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
> 📚 For detailed Logfire documentation, see the [template observability guide](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/observability.md).
|
|
580
|
+
{%- endif %}
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## API Examples
|
|
585
|
+
|
|
586
|
+
{%- if cookiecutter.use_jwt %}
|
|
587
|
+
|
|
588
|
+
### Authentication
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
# Register
|
|
592
|
+
curl -X POST http://localhost:{{ cookiecutter.backend_port }}/api/v1/auth/register \
|
|
593
|
+
-H "Content-Type: application/json" \
|
|
594
|
+
-d '{"email": "user@example.com", "password": "password123"}'
|
|
595
|
+
|
|
596
|
+
# Login
|
|
597
|
+
curl -X POST http://localhost:{{ cookiecutter.backend_port }}/api/v1/auth/login \
|
|
598
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
599
|
+
-d "username=user@example.com&password=password123"
|
|
600
|
+
|
|
601
|
+
# Protected endpoint
|
|
602
|
+
curl http://localhost:{{ cookiecutter.backend_port }}/api/v1/users/me \
|
|
603
|
+
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
|
|
604
|
+
```
|
|
605
|
+
{%- endif %}
|
|
606
|
+
|
|
607
|
+
### Health Check
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
curl http://localhost:{{ cookiecutter.backend_port }}/api/v1/health
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
614
|
+
|
|
615
|
+
### AI Agent (WebSocket)
|
|
616
|
+
|
|
617
|
+
Connect to `ws://localhost:{{ cookiecutter.backend_port }}/api/v1/agent/ws` and send:
|
|
618
|
+
|
|
619
|
+
```json
|
|
620
|
+
{"type": "message", "content": "Hello!", "history": []}
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
Response events:
|
|
624
|
+
- `start` - Stream started
|
|
625
|
+
- `token` - Text token (streaming)
|
|
626
|
+
- `tool_call` - Tool invocation
|
|
627
|
+
- `end` - Stream complete
|
|
628
|
+
{%- endif %}
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
## Testing
|
|
633
|
+
|
|
634
|
+
```bash
|
|
635
|
+
cd backend
|
|
636
|
+
|
|
637
|
+
# Run all tests
|
|
638
|
+
pytest
|
|
639
|
+
|
|
640
|
+
# With coverage
|
|
641
|
+
pytest --cov=app --cov-report=term-missing
|
|
642
|
+
|
|
643
|
+
# Specific test
|
|
644
|
+
pytest tests/api/test_health.py -v
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
{%- if cookiecutter.use_frontend %}
|
|
648
|
+
|
|
649
|
+
### Frontend Tests
|
|
650
|
+
|
|
651
|
+
```bash
|
|
652
|
+
cd frontend
|
|
653
|
+
|
|
654
|
+
# Unit tests (Vitest)
|
|
655
|
+
bun test
|
|
656
|
+
|
|
657
|
+
# E2E tests (Playwright)
|
|
658
|
+
bun test:e2e
|
|
659
|
+
```
|
|
660
|
+
{%- endif %}
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Deployment
|
|
665
|
+
|
|
666
|
+
> 📚 For detailed deployment guide, see the [template documentation](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/deployment.md).
|
|
667
|
+
|
|
668
|
+
### Quick Docker Deploy
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
# Build production images
|
|
672
|
+
docker compose -f docker-compose.yml -f docker-compose.prod.yml build
|
|
673
|
+
|
|
674
|
+
# Start with production config
|
|
675
|
+
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Environment Checklist
|
|
679
|
+
|
|
680
|
+
- [ ] Set `ENVIRONMENT=production`
|
|
681
|
+
- [ ] Set `DEBUG=false`
|
|
682
|
+
- [ ] Change `SECRET_KEY` (use `openssl rand -hex 32`)
|
|
683
|
+
{%- if cookiecutter.use_postgresql %}
|
|
684
|
+
- [ ] Configure production database credentials
|
|
685
|
+
{%- endif %}
|
|
686
|
+
{%- if cookiecutter.enable_logfire %}
|
|
687
|
+
- [ ] Set `LOGFIRE_TOKEN` for production
|
|
688
|
+
{%- endif %}
|
|
689
|
+
{%- if cookiecutter.enable_sentry %}
|
|
690
|
+
- [ ] Configure `SENTRY_DSN`
|
|
691
|
+
{%- endif %}
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## Documentation
|
|
696
|
+
|
|
697
|
+
| Resource | Link |
|
|
698
|
+
|----------|------|
|
|
699
|
+
| Template Repository | [github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template) |
|
|
700
|
+
| Architecture Guide | [docs/architecture.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md) |
|
|
701
|
+
{%- if cookiecutter.use_frontend %}
|
|
702
|
+
| Frontend Guide | [docs/frontend.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/frontend.md) |
|
|
703
|
+
{%- endif %}
|
|
704
|
+
{%- if cookiecutter.enable_ai_agent %}
|
|
705
|
+
| AI Agent Guide | [docs/ai-agent.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/ai-agent.md) |
|
|
706
|
+
{%- endif %}
|
|
707
|
+
{%- if cookiecutter.enable_logfire %}
|
|
708
|
+
| Observability Guide | [docs/observability.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/observability.md) |
|
|
709
|
+
{%- endif %}
|
|
710
|
+
| Deployment Guide | [docs/deployment.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/deployment.md) |
|
|
711
|
+
| Development Guide | [docs/development.md](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/development.md) |
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
## License
|
|
716
|
+
|
|
717
|
+
MIT
|
|
718
|
+
|
|
719
|
+
---
|
|
720
|
+
|
|
721
|
+
<p align="center">
|
|
722
|
+
<sub>Built with <a href="https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template">Full-Stack FastAPI + Next.js Template</a></sub>
|
|
723
|
+
</p>
|