fastapi-fullstack 0.1.7__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.7.dist-info/METADATA +739 -0
- fastapi_fullstack-0.1.7.dist-info/RECORD +241 -0
- fastapi_fullstack-0.1.7.dist-info/WHEEL +4 -0
- fastapi_fullstack-0.1.7.dist-info/entry_points.txt +2 -0
- fastapi_fullstack-0.1.7.dist-info/licenses/LICENSE +21 -0
- fastapi_gen/__init__.py +3 -0
- fastapi_gen/cli.py +442 -0
- fastapi_gen/config.py +356 -0
- fastapi_gen/generator.py +207 -0
- fastapi_gen/prompts.py +874 -0
- fastapi_gen/template/VARIABLES.md +276 -0
- fastapi_gen/template/cookiecutter.json +93 -0
- fastapi_gen/template/hooks/post_gen_project.py +355 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.env.prod.example +56 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +150 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/.gitignore +109 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/AGENTS.md +55 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/CLAUDE.md +99 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/Makefile +315 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/README.md +768 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.dockerignore +60 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.env.example +155 -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 +447 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/__init__.py +23 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/assistant.py +226 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/langchain_assistant.py +226 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/prompts.py +10 -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 +541 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/exception_handlers.py +98 -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 +902 -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 +498 -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 +267 -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 +130 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/main.py +334 -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 +838 -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 +192 -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 +850 -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 +180 -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_admin.py +890 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_agents.py +261 -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 +435 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.yml +241 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docs/adding_features.md +132 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docs/architecture.md +63 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docs/patterns.md +161 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/docs/testing.md +120 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.dockerignore +40 -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 +648 -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 +69 -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/[locale]/(auth)/layout.tsx +11 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(auth)/login/page.tsx +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(auth)/register/page.tsx +5 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/chat/page.tsx +48 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/dashboard/page.tsx +99 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/layout.tsx +17 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/profile/page.tsx +152 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/auth/callback/page.tsx +113 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/layout.tsx +46 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/page.tsx +73 -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/globals.css +323 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/layout.tsx +22 -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 +234 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/chat-input.tsx +72 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/conversation-sidebar.tsx +328 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/copy-button.tsx +46 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/index.ts +11 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/local-conversation-sidebar.tsx +295 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/markdown-content.tsx +167 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/message-item.tsx +79 -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 +79 -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 +65 -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 +82 -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 +105 -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 +56 -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 +13 -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/components/ui/sheet.tsx +109 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/index.ts +7 -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 +181 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-local-chat.ts +165 -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 +37 -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 +31 -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 +64 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/chat-sidebar-store.ts +17 -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 +9 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/local-chat-store.ts +255 -0
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/sidebar-store.ts +17 -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 +83 -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,648 @@
|
|
|
1
|
+
# Full-Stack FastAPI + Next.js Template for AI/LLM Applications
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/stargazers"><img src="https://img.shields.io/github/stars/vstorm-co/full-stack-fastapi-nextjs-llm-template?style=flat&logo=github&color=yellow" alt="GitHub Stars"></a>
|
|
5
|
+
<a href="https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/LICENSE"><img src="https://img.shields.io/github/license/vstorm-co/full-stack-fastapi-nextjs-llm-template?color=blue" alt="License"></a>
|
|
6
|
+
<a href="https://www.python.org/"><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"></a>
|
|
7
|
+
<a href="https://pypi.org/project/fastapi-fullstack/"><img src="https://img.shields.io/pypi/v/fastapi-fullstack?color=green&logo=pypi&logoColor=white" alt="PyPI"></a>
|
|
8
|
+
<img src="https://img.shields.io/badge/coverage-100%25-brightgreen" alt="Coverage">
|
|
9
|
+
<img src="https://img.shields.io/badge/integrations-20%2B-brightgreen" alt="20+ Integrations">
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<b>Production-ready project generator for AI/LLM applications with 20+ enterprise integrations.</b><br>
|
|
14
|
+
<sub>Built with FastAPI, Next.js 15, PydanticAI/LangChain, and everything you need for professional business applications.</sub>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="#-why-this-template">Why This Template</a> •
|
|
19
|
+
<a href="#-features">Features</a> •
|
|
20
|
+
<a href="#-demo">Demo</a> •
|
|
21
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
22
|
+
<a href="#-architecture">Architecture</a> •
|
|
23
|
+
<a href="#-ai-agent">AI Agent</a> •
|
|
24
|
+
<a href="#-observability-with-logfire">Logfire</a> •
|
|
25
|
+
<a href="#-documentation">Documentation</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
## Related Projects
|
|
29
|
+
|
|
30
|
+
> **Building advanced AI agents?** Check out [pydantic-deep](https://github.com/vstorm-co/pydantic-deepagents) - a deep agent framework built on pydantic-ai with planning, filesystem, and subagent capabilities.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🎯 Why This Template
|
|
35
|
+
|
|
36
|
+
Building AI/LLM applications requires more than just an API wrapper. You need:
|
|
37
|
+
|
|
38
|
+
- **Type-safe AI agents** with tool/function calling
|
|
39
|
+
- **Real-time streaming** responses via WebSocket
|
|
40
|
+
- **Conversation persistence** and history management
|
|
41
|
+
- **Production infrastructure** - auth, rate limiting, observability
|
|
42
|
+
- **Enterprise integrations** - background tasks, webhooks, admin panels
|
|
43
|
+
|
|
44
|
+
This template gives you all of that out of the box, with **20+ configurable integrations** so you can focus on building your AI product, not boilerplate.
|
|
45
|
+
|
|
46
|
+
### Perfect For
|
|
47
|
+
|
|
48
|
+
- 🤖 **AI Chatbots & Assistants** - PydanticAI or LangChain agents with streaming responses
|
|
49
|
+
- 📊 **ML Applications** - Background task processing with Celery/Taskiq
|
|
50
|
+
- 🏢 **Enterprise SaaS** - Full auth, admin panel, webhooks, and more
|
|
51
|
+
- 🚀 **Startups** - Ship fast with production-ready infrastructure
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## ✨ Features
|
|
56
|
+
|
|
57
|
+
### 🤖 AI/LLM First
|
|
58
|
+
|
|
59
|
+
- **[PydanticAI](https://ai.pydantic.dev)** or **[LangChain](https://python.langchain.com)** - Choose your preferred AI framework
|
|
60
|
+
- **WebSocket Streaming** - Real-time responses with full event access
|
|
61
|
+
- **Conversation Persistence** - Save chat history to database
|
|
62
|
+
- **Custom Tools** - Easily extend agent capabilities
|
|
63
|
+
- **Multi-model Support** - OpenAI, Anthropic, and more
|
|
64
|
+
- **Observability** - Logfire for PydanticAI, LangSmith for LangChain
|
|
65
|
+
|
|
66
|
+
### ⚡ Backend (FastAPI)
|
|
67
|
+
|
|
68
|
+
- **[FastAPI](https://fastapi.tiangolo.com)** + **[Pydantic v2](https://docs.pydantic.dev)** - High-performance async API
|
|
69
|
+
- **Multiple Databases** - PostgreSQL (async), MongoDB (async), SQLite
|
|
70
|
+
- **Authentication** - JWT + Refresh tokens, API Keys, OAuth2 (Google)
|
|
71
|
+
- **Background Tasks** - Celery, Taskiq, or ARQ
|
|
72
|
+
- **Django-style CLI** - Custom management commands with auto-discovery
|
|
73
|
+
|
|
74
|
+
### 🎨 Frontend (Next.js 15)
|
|
75
|
+
|
|
76
|
+
- **React 19** + **TypeScript** + **Tailwind CSS v4**
|
|
77
|
+
- **AI Chat Interface** - WebSocket streaming, tool call visualization
|
|
78
|
+
- **Authentication** - HTTP-only cookies, auto-refresh
|
|
79
|
+
- **Dark Mode** + **i18n** (optional)
|
|
80
|
+
|
|
81
|
+
### 🔌 20+ Enterprise Integrations
|
|
82
|
+
|
|
83
|
+
| Category | Integrations |
|
|
84
|
+
|----------|-------------|
|
|
85
|
+
| **AI Frameworks** | PydanticAI, LangChain |
|
|
86
|
+
| **Caching & State** | Redis, fastapi-cache2 |
|
|
87
|
+
| **Security** | Rate limiting, CORS, CSRF protection |
|
|
88
|
+
| **Observability** | Logfire, LangSmith, Sentry, Prometheus |
|
|
89
|
+
| **Admin** | SQLAdmin panel with auth |
|
|
90
|
+
| **Events** | Webhooks, WebSockets |
|
|
91
|
+
| **DevOps** | Docker, GitHub Actions, GitLab CI, Kubernetes |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🎬 Demo
|
|
96
|
+
|
|
97
|
+
<p align="center">
|
|
98
|
+
<img src="https://raw.githubusercontent.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/main/assets/app_start.gif" alt="FastAPI Fullstack Generator Demo">
|
|
99
|
+
</p>
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🚀 Quick Start
|
|
104
|
+
|
|
105
|
+
### Installation
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# pip
|
|
109
|
+
pip install fastapi-fullstack
|
|
110
|
+
|
|
111
|
+
# uv (recommended)
|
|
112
|
+
uv tool install fastapi-fullstack
|
|
113
|
+
|
|
114
|
+
# pipx
|
|
115
|
+
pipx install fastapi-fullstack
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Create Your Project
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Interactive wizard (recommended)
|
|
122
|
+
fastapi-fullstack new
|
|
123
|
+
|
|
124
|
+
# Quick mode with options
|
|
125
|
+
fastapi-fullstack create my_ai_app \
|
|
126
|
+
--database postgresql \
|
|
127
|
+
--auth jwt \
|
|
128
|
+
--frontend nextjs
|
|
129
|
+
|
|
130
|
+
# Use presets for common setups
|
|
131
|
+
fastapi-fullstack create my_ai_app --preset production # Full production setup
|
|
132
|
+
fastapi-fullstack create my_ai_app --preset ai-agent # AI agent with streaming
|
|
133
|
+
|
|
134
|
+
# Minimal project (no extras)
|
|
135
|
+
fastapi-fullstack create my_ai_app --minimal
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Start Development
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
cd my_ai_app
|
|
142
|
+
|
|
143
|
+
# Backend
|
|
144
|
+
cd backend
|
|
145
|
+
uv sync
|
|
146
|
+
# .env is pre-configured for development - just add your API keys
|
|
147
|
+
alembic upgrade head
|
|
148
|
+
|
|
149
|
+
# Create admin user
|
|
150
|
+
uv run my_ai_app user create --email admin@example.com --password secret123 --superuser
|
|
151
|
+
|
|
152
|
+
# Start server
|
|
153
|
+
uv run uvicorn app.main:app --reload
|
|
154
|
+
|
|
155
|
+
# Frontend (new terminal)
|
|
156
|
+
cd frontend
|
|
157
|
+
bun install
|
|
158
|
+
bun dev
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> **Note:** The admin user is required to access the SQLAdmin panel at `/admin`. Use the `--superuser` flag to grant full admin privileges.
|
|
162
|
+
|
|
163
|
+
**Access:**
|
|
164
|
+
- API: http://localhost:8000
|
|
165
|
+
- Docs: http://localhost:8000/docs
|
|
166
|
+
- Admin Panel: http://localhost:8000/admin
|
|
167
|
+
- Frontend: http://localhost:3000
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 📸 Screenshots
|
|
172
|
+
|
|
173
|
+
### Chat Interface
|
|
174
|
+
| Light Mode | Dark Mode |
|
|
175
|
+
|:---:|:---:|
|
|
176
|
+
|  |  |
|
|
177
|
+
|
|
178
|
+
### Authentication
|
|
179
|
+
| Register | Login |
|
|
180
|
+
|:---:|:---:|
|
|
181
|
+
|  |  |
|
|
182
|
+
|
|
183
|
+
### Observability
|
|
184
|
+
| Logfire (PydanticAI) | LangSmith (LangChain) |
|
|
185
|
+
|:---:|:---:|
|
|
186
|
+
|  |  |
|
|
187
|
+
|
|
188
|
+
### Admin, Monitoring & API
|
|
189
|
+
| Celery Flower | SQLAdmin Panel |
|
|
190
|
+
|:---:|:---:|
|
|
191
|
+
|  |  |
|
|
192
|
+
|
|
193
|
+
| API Documentation |
|
|
194
|
+
|:---:|
|
|
195
|
+
|  |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 🏗️ Architecture
|
|
200
|
+
|
|
201
|
+
```mermaid
|
|
202
|
+
graph TB
|
|
203
|
+
subgraph Frontend["Frontend (Next.js 15)"]
|
|
204
|
+
UI[React Components]
|
|
205
|
+
WS[WebSocket Client]
|
|
206
|
+
Store[Zustand Stores]
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
subgraph Backend["Backend (FastAPI)"]
|
|
210
|
+
API[API Routes]
|
|
211
|
+
Services[Services Layer]
|
|
212
|
+
Repos[Repositories]
|
|
213
|
+
Agent[AI Agent]
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
subgraph Infrastructure
|
|
217
|
+
DB[(PostgreSQL/MongoDB)]
|
|
218
|
+
Redis[(Redis)]
|
|
219
|
+
Queue[Celery/Taskiq]
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
subgraph External
|
|
223
|
+
LLM[OpenAI/Anthropic]
|
|
224
|
+
Webhook[Webhook Endpoints]
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
UI --> API
|
|
228
|
+
WS <--> Agent
|
|
229
|
+
API --> Services
|
|
230
|
+
Services --> Repos
|
|
231
|
+
Services --> Agent
|
|
232
|
+
Repos --> DB
|
|
233
|
+
Agent --> LLM
|
|
234
|
+
Services --> Redis
|
|
235
|
+
Services --> Queue
|
|
236
|
+
Services --> Webhook
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Layered Architecture
|
|
240
|
+
|
|
241
|
+
The backend follows a clean **Repository + Service** pattern:
|
|
242
|
+
|
|
243
|
+
```mermaid
|
|
244
|
+
graph LR
|
|
245
|
+
A[API Routes] --> B[Services]
|
|
246
|
+
B --> C[Repositories]
|
|
247
|
+
C --> D[(Database)]
|
|
248
|
+
|
|
249
|
+
B --> E[External APIs]
|
|
250
|
+
B --> F[AI Agents]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
| Layer | Responsibility |
|
|
254
|
+
|-------|---------------|
|
|
255
|
+
| **Routes** | HTTP handling, validation, auth |
|
|
256
|
+
| **Services** | Business logic, orchestration |
|
|
257
|
+
| **Repositories** | Data access, queries |
|
|
258
|
+
|
|
259
|
+
See [Architecture Documentation](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md) for details.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 🤖 AI Agent
|
|
264
|
+
|
|
265
|
+
Choose between **PydanticAI** or **LangChain** when generating your project, with support for multiple LLM providers:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# PydanticAI with OpenAI (default)
|
|
269
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai
|
|
270
|
+
|
|
271
|
+
# PydanticAI with Anthropic
|
|
272
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai --llm-provider anthropic
|
|
273
|
+
|
|
274
|
+
# PydanticAI with OpenRouter
|
|
275
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai --llm-provider openrouter
|
|
276
|
+
|
|
277
|
+
# LangChain with OpenAI
|
|
278
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework langchain
|
|
279
|
+
|
|
280
|
+
# LangChain with Anthropic
|
|
281
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework langchain --llm-provider anthropic
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Supported LLM Providers
|
|
285
|
+
|
|
286
|
+
| Framework | OpenAI | Anthropic | OpenRouter |
|
|
287
|
+
|-----------|:------:|:---------:|:----------:|
|
|
288
|
+
| **PydanticAI** | ✓ | ✓ | ✓ |
|
|
289
|
+
| **LangChain** | ✓ | ✓ | - |
|
|
290
|
+
|
|
291
|
+
### PydanticAI Integration
|
|
292
|
+
|
|
293
|
+
Type-safe agents with full dependency injection:
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
# app/agents/assistant.py
|
|
297
|
+
from pydantic_ai import Agent, RunContext
|
|
298
|
+
|
|
299
|
+
@dataclass
|
|
300
|
+
class Deps:
|
|
301
|
+
user_id: str | None = None
|
|
302
|
+
db: AsyncSession | None = None
|
|
303
|
+
|
|
304
|
+
agent = Agent[Deps, str](
|
|
305
|
+
model="openai:gpt-4o-mini",
|
|
306
|
+
system_prompt="You are a helpful assistant.",
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
@agent.tool
|
|
310
|
+
async def search_database(ctx: RunContext[Deps], query: str) -> list[dict]:
|
|
311
|
+
"""Search the database for relevant information."""
|
|
312
|
+
# Access user context and database via ctx.deps
|
|
313
|
+
...
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### LangChain Integration
|
|
317
|
+
|
|
318
|
+
Flexible agents with LangGraph:
|
|
319
|
+
|
|
320
|
+
```python
|
|
321
|
+
# app/agents/langchain_assistant.py
|
|
322
|
+
from langchain.tools import tool
|
|
323
|
+
from langgraph.prebuilt import create_react_agent
|
|
324
|
+
|
|
325
|
+
@tool
|
|
326
|
+
def search_database(query: str) -> list[dict]:
|
|
327
|
+
"""Search the database for relevant information."""
|
|
328
|
+
...
|
|
329
|
+
|
|
330
|
+
agent = create_react_agent(
|
|
331
|
+
model=ChatOpenAI(model="gpt-4o-mini"),
|
|
332
|
+
tools=[search_database],
|
|
333
|
+
prompt="You are a helpful assistant.",
|
|
334
|
+
)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### WebSocket Streaming
|
|
338
|
+
|
|
339
|
+
Both frameworks use the same WebSocket endpoint with real-time streaming:
|
|
340
|
+
|
|
341
|
+
```python
|
|
342
|
+
@router.websocket("/ws")
|
|
343
|
+
async def agent_ws(websocket: WebSocket):
|
|
344
|
+
await websocket.accept()
|
|
345
|
+
|
|
346
|
+
# Works with both PydanticAI and LangChain
|
|
347
|
+
async for event in agent.stream(user_input):
|
|
348
|
+
await websocket.send_json({
|
|
349
|
+
"type": "text_delta",
|
|
350
|
+
"content": event.content
|
|
351
|
+
})
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Observability
|
|
355
|
+
|
|
356
|
+
Each framework has its own observability solution:
|
|
357
|
+
|
|
358
|
+
| Framework | Observability | Dashboard |
|
|
359
|
+
|-----------|--------------|-----------|
|
|
360
|
+
| **PydanticAI** | [Logfire](https://logfire.pydantic.dev) | Agent runs, tool calls, token usage |
|
|
361
|
+
| **LangChain** | [LangSmith](https://smith.langchain.com) | Traces, feedback, datasets |
|
|
362
|
+
|
|
363
|
+
See [AI Agent Documentation](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/ai-agent.md) for more.
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## 📊 Observability
|
|
368
|
+
|
|
369
|
+
### Logfire (for PydanticAI)
|
|
370
|
+
|
|
371
|
+
[Logfire](https://logfire.pydantic.dev) provides complete observability for your application - from AI agents to database queries. Built by the Pydantic team, it offers first-class support for the entire Python ecosystem.
|
|
372
|
+
|
|
373
|
+
```mermaid
|
|
374
|
+
graph LR
|
|
375
|
+
subgraph Your App
|
|
376
|
+
API[FastAPI]
|
|
377
|
+
Agent[PydanticAI]
|
|
378
|
+
DB[(Database)]
|
|
379
|
+
Cache[(Redis)]
|
|
380
|
+
Queue[Celery/Taskiq]
|
|
381
|
+
HTTP[HTTPX]
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
subgraph Logfire
|
|
385
|
+
Traces[Traces]
|
|
386
|
+
Metrics[Metrics]
|
|
387
|
+
Logs[Logs]
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
API --> Traces
|
|
391
|
+
Agent --> Traces
|
|
392
|
+
DB --> Traces
|
|
393
|
+
Cache --> Traces
|
|
394
|
+
Queue --> Traces
|
|
395
|
+
HTTP --> Traces
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
| Component | What You See |
|
|
399
|
+
|-----------|-------------|
|
|
400
|
+
| **PydanticAI** | Agent runs, tool calls, LLM requests, token usage, streaming events |
|
|
401
|
+
| **FastAPI** | Request/response traces, latency, status codes, route performance |
|
|
402
|
+
| **PostgreSQL/MongoDB** | Query execution time, slow queries, connection pool stats |
|
|
403
|
+
| **Redis** | Cache hits/misses, command latency, key patterns |
|
|
404
|
+
| **Celery/Taskiq** | Task execution, queue depth, worker performance |
|
|
405
|
+
| **HTTPX** | External API calls, response times, error rates |
|
|
406
|
+
|
|
407
|
+
### LangSmith (for LangChain)
|
|
408
|
+
|
|
409
|
+
[LangSmith](https://smith.langchain.com) provides observability specifically designed for LangChain applications:
|
|
410
|
+
|
|
411
|
+
| Feature | Description |
|
|
412
|
+
|---------|-------------|
|
|
413
|
+
| **Traces** | Full execution traces for agent runs and chains |
|
|
414
|
+
| **Feedback** | Collect user feedback on agent responses |
|
|
415
|
+
| **Datasets** | Build evaluation datasets from production data |
|
|
416
|
+
| **Monitoring** | Track latency, errors, and token usage |
|
|
417
|
+
|
|
418
|
+
LangSmith is automatically configured when you choose LangChain:
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
# .env
|
|
422
|
+
LANGCHAIN_TRACING_V2=true
|
|
423
|
+
LANGCHAIN_API_KEY=your-api-key
|
|
424
|
+
LANGCHAIN_PROJECT=my_project
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Configuration
|
|
428
|
+
|
|
429
|
+
Enable Logfire and select which components to instrument:
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
fastapi-fullstack new
|
|
433
|
+
# ✓ Enable Logfire observability
|
|
434
|
+
# ✓ Instrument FastAPI
|
|
435
|
+
# ✓ Instrument Database
|
|
436
|
+
# ✓ Instrument Redis
|
|
437
|
+
# ✓ Instrument Celery
|
|
438
|
+
# ✓ Instrument HTTPX
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Usage
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
# Automatic instrumentation in app/main.py
|
|
445
|
+
import logfire
|
|
446
|
+
|
|
447
|
+
logfire.configure()
|
|
448
|
+
logfire.instrument_fastapi(app)
|
|
449
|
+
logfire.instrument_asyncpg()
|
|
450
|
+
logfire.instrument_redis()
|
|
451
|
+
logfire.instrument_httpx()
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
```python
|
|
455
|
+
# Manual spans for custom logic
|
|
456
|
+
with logfire.span("process_order", order_id=order.id):
|
|
457
|
+
await validate_order(order)
|
|
458
|
+
await charge_payment(order)
|
|
459
|
+
await send_confirmation(order)
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
For more details, see [Logfire Documentation](https://logfire.pydantic.dev/docs/integrations/).
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## 🛠️ Django-style CLI
|
|
467
|
+
|
|
468
|
+
Each generated project includes a powerful CLI inspired by Django's management commands:
|
|
469
|
+
|
|
470
|
+
### Built-in Commands
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Server
|
|
474
|
+
my_app server run --reload
|
|
475
|
+
my_app server routes
|
|
476
|
+
|
|
477
|
+
# Database (Alembic wrapper)
|
|
478
|
+
my_app db init
|
|
479
|
+
my_app db migrate -m "Add users"
|
|
480
|
+
my_app db upgrade
|
|
481
|
+
|
|
482
|
+
# Users
|
|
483
|
+
my_app user create --email admin@example.com --superuser
|
|
484
|
+
my_app user list
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Custom Commands
|
|
488
|
+
|
|
489
|
+
Create your own commands with auto-discovery:
|
|
490
|
+
|
|
491
|
+
```python
|
|
492
|
+
# app/commands/seed.py
|
|
493
|
+
from app.commands import command, success, error
|
|
494
|
+
import click
|
|
495
|
+
|
|
496
|
+
@command("seed", help="Seed database with test data")
|
|
497
|
+
@click.option("--count", "-c", default=10, type=int)
|
|
498
|
+
@click.option("--dry-run", is_flag=True)
|
|
499
|
+
def seed_database(count: int, dry_run: bool):
|
|
500
|
+
"""Seed the database with sample data."""
|
|
501
|
+
if dry_run:
|
|
502
|
+
info(f"[DRY RUN] Would create {count} records")
|
|
503
|
+
return
|
|
504
|
+
|
|
505
|
+
# Your logic here
|
|
506
|
+
success(f"Created {count} records!")
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Commands are **automatically discovered** from `app/commands/` - just create a file and use the `@command` decorator.
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
my_app cmd seed --count 100
|
|
513
|
+
my_app cmd seed --dry-run
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## 📁 Generated Project Structure
|
|
519
|
+
|
|
520
|
+
```
|
|
521
|
+
my_project/
|
|
522
|
+
├── backend/
|
|
523
|
+
│ ├── app/
|
|
524
|
+
│ │ ├── main.py # FastAPI app with lifespan
|
|
525
|
+
│ │ ├── api/
|
|
526
|
+
│ │ │ ├── routes/v1/ # Versioned API endpoints
|
|
527
|
+
│ │ │ ├── deps.py # Dependency injection
|
|
528
|
+
│ │ │ └── router.py # Route aggregation
|
|
529
|
+
│ │ ├── core/ # Config, security, middleware
|
|
530
|
+
│ │ ├── db/models/ # SQLAlchemy/MongoDB models
|
|
531
|
+
│ │ ├── schemas/ # Pydantic schemas
|
|
532
|
+
│ │ ├── repositories/ # Data access layer
|
|
533
|
+
│ │ ├── services/ # Business logic
|
|
534
|
+
│ │ ├── agents/ # AI agents with centralized prompts
|
|
535
|
+
│ │ ├── commands/ # Django-style CLI commands
|
|
536
|
+
│ │ └── worker/ # Background tasks
|
|
537
|
+
│ ├── cli/ # Project CLI
|
|
538
|
+
│ ├── tests/ # pytest test suite
|
|
539
|
+
│ └── alembic/ # Database migrations
|
|
540
|
+
├── frontend/
|
|
541
|
+
│ ├── src/
|
|
542
|
+
│ │ ├── app/ # Next.js App Router
|
|
543
|
+
│ │ ├── components/ # React components
|
|
544
|
+
│ │ ├── hooks/ # useChat, useWebSocket, etc.
|
|
545
|
+
│ │ └── stores/ # Zustand state management
|
|
546
|
+
│ └── e2e/ # Playwright tests
|
|
547
|
+
├── docker-compose.yml
|
|
548
|
+
├── Makefile
|
|
549
|
+
└── README.md
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
Generated projects include version metadata in `pyproject.toml` for tracking:
|
|
553
|
+
|
|
554
|
+
```toml
|
|
555
|
+
[tool.fastapi-fullstack]
|
|
556
|
+
generator_version = "0.1.5"
|
|
557
|
+
generated_at = "2024-12-21T10:30:00+00:00"
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## ⚙️ Configuration Options
|
|
563
|
+
|
|
564
|
+
### Core Options
|
|
565
|
+
|
|
566
|
+
| Option | Values | Description |
|
|
567
|
+
|--------|--------|-------------|
|
|
568
|
+
| **Database** | `postgresql`, `mongodb`, `sqlite`, `none` | Async by default |
|
|
569
|
+
| **Auth** | `jwt`, `api_key`, `both`, `none` | JWT includes user management |
|
|
570
|
+
| **OAuth** | `none`, `google` | Social login |
|
|
571
|
+
| **AI Framework** | `pydantic_ai`, `langchain` | Choose your AI agent framework |
|
|
572
|
+
| **LLM Provider** | `openai`, `anthropic`, `openrouter` | OpenRouter only with PydanticAI |
|
|
573
|
+
| **Background Tasks** | `none`, `celery`, `taskiq`, `arq` | Distributed queues |
|
|
574
|
+
| **Frontend** | `none`, `nextjs` | Next.js 15 + React 19 |
|
|
575
|
+
|
|
576
|
+
### Presets
|
|
577
|
+
|
|
578
|
+
| Preset | Description |
|
|
579
|
+
|--------|-------------|
|
|
580
|
+
| `--preset production` | Full production setup with Redis, Sentry, Kubernetes, Prometheus |
|
|
581
|
+
| `--preset ai-agent` | AI agent with WebSocket streaming and conversation persistence |
|
|
582
|
+
| `--minimal` | Minimal project with no extras |
|
|
583
|
+
|
|
584
|
+
### Integrations
|
|
585
|
+
|
|
586
|
+
Select what you need:
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
fastapi-fullstack new
|
|
590
|
+
# ✓ Redis (caching/sessions)
|
|
591
|
+
# ✓ Rate limiting (slowapi)
|
|
592
|
+
# ✓ Pagination (fastapi-pagination)
|
|
593
|
+
# ✓ Admin Panel (SQLAdmin)
|
|
594
|
+
# ✓ AI Agent (PydanticAI or LangChain)
|
|
595
|
+
# ✓ Webhooks
|
|
596
|
+
# ✓ Sentry
|
|
597
|
+
# ✓ Logfire / LangSmith
|
|
598
|
+
# ✓ Prometheus
|
|
599
|
+
# ... and more
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## 📚 Documentation
|
|
605
|
+
|
|
606
|
+
| Document | Description |
|
|
607
|
+
|----------|-------------|
|
|
608
|
+
| [Architecture](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md) | Repository + Service pattern, layered design |
|
|
609
|
+
| [Frontend](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/frontend.md) | Next.js setup, auth, state management |
|
|
610
|
+
| [AI Agent](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/ai-agent.md) | PydanticAI, tools, WebSocket streaming |
|
|
611
|
+
| [Observability](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/observability.md) | Logfire integration, tracing, metrics |
|
|
612
|
+
| [Deployment](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/deployment.md) | Docker, Kubernetes, production setup |
|
|
613
|
+
| [Development](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/development.md) | Local setup, testing, debugging |
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Star History
|
|
618
|
+
|
|
619
|
+
[](https://www.star-history.com/#vstorm-co/full-stack-fastapi-nextjs-llm-template&type=date&legend=top-left)
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## 🙏 Inspiration
|
|
624
|
+
|
|
625
|
+
This project is inspired by:
|
|
626
|
+
|
|
627
|
+
- [full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template) by @tiangolo
|
|
628
|
+
- [fastapi-template](https://github.com/s3rius/fastapi-template) by @s3rius
|
|
629
|
+
- [FastAPI Best Practices](https://github.com/zhanymkanov/fastapi-best-practices) by @zhanymkanov
|
|
630
|
+
- Django's management commands system
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## 🤝 Contributing
|
|
635
|
+
|
|
636
|
+
Contributions are welcome! Please read our [Contributing Guide](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/CONTRIBUTING.md) for details.
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
## 📄 License
|
|
641
|
+
|
|
642
|
+
MIT License - see [LICENSE](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/LICENSE) for details.
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
<p align="center">
|
|
647
|
+
Made with ❤️ by <a href="https://github.com/vstorm-co">VStorm</a>
|
|
648
|
+
</p>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{%- if cookiecutter.use_frontend and cookiecutter.use_jwt %}
|
|
2
|
+
import { test as setup, expect } from "@playwright/test";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const authFile = path.join(__dirname, "../.playwright/.auth/user.json");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Authentication setup - runs before all tests.
|
|
9
|
+
*
|
|
10
|
+
* This creates an authenticated session that other tests can reuse.
|
|
11
|
+
*/
|
|
12
|
+
setup("authenticate", async ({ page }) => {
|
|
13
|
+
// Test credentials - adjust for your environment
|
|
14
|
+
const testEmail = process.env.TEST_USER_EMAIL || "test@example.com";
|
|
15
|
+
const testPassword = process.env.TEST_USER_PASSWORD || "TestPassword123!";
|
|
16
|
+
|
|
17
|
+
// Navigate to login page
|
|
18
|
+
await page.goto("/login");
|
|
19
|
+
|
|
20
|
+
// Fill in login form
|
|
21
|
+
await page.getByLabel(/email/i).fill(testEmail);
|
|
22
|
+
await page.getByLabel(/password/i).fill(testPassword);
|
|
23
|
+
|
|
24
|
+
// Submit and wait for redirect
|
|
25
|
+
await page.getByRole("button", { name: /sign in|log in|login/i }).click();
|
|
26
|
+
|
|
27
|
+
// Wait for authentication to complete - adjust selector based on your app
|
|
28
|
+
await expect(
|
|
29
|
+
page.getByRole("link", { name: /dashboard|home/i }).or(
|
|
30
|
+
page.getByText(/welcome/i)
|
|
31
|
+
)
|
|
32
|
+
).toBeVisible({ timeout: 10000 });
|
|
33
|
+
|
|
34
|
+
// Save authentication state
|
|
35
|
+
await page.context().storageState({ path: authFile });
|
|
36
|
+
});
|
|
37
|
+
{%- elif cookiecutter.use_frontend %}
|
|
38
|
+
import { test as setup } from "@playwright/test";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Setup - no authentication required.
|
|
42
|
+
*/
|
|
43
|
+
setup("setup", async () => {
|
|
44
|
+
// No authentication needed
|
|
45
|
+
});
|
|
46
|
+
{%- else %}
|
|
47
|
+
/* Auth setup - frontend not configured */
|
|
48
|
+
export {};
|
|
49
|
+
{%- endif %}
|