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,739 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastapi-fullstack
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Full-stack FastAPI + Next.js template generator with PydanticAI/LangChain agents, WebSocket streaming, 20+ enterprise integrations, and Logfire/LangSmith observability. Ship AI apps fast. CLI tool to generate production-ready FastAPI + Next.js projects with AI agents, auth, and observability.
|
|
5
|
+
Project-URL: Homepage, https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template
|
|
6
|
+
Project-URL: Documentation, https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template
|
|
8
|
+
Author-email: Vstorm <hr@vstorm.co>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-agents,celery,cookiecutter,docker,fastapi,full-stack,langchain,langgraph,llm,logfire,mongodb,nextjs,observability,postgresql,pydantic-ai,python,react,redis,template,typescript
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Framework :: FastAPI
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: click>=8.1.0
|
|
23
|
+
Requires-Dist: cookiecutter>=2.6.0
|
|
24
|
+
Requires-Dist: email-validator>=2.0.0
|
|
25
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0
|
|
27
|
+
Requires-Dist: questionary>=2.0.0
|
|
28
|
+
Requires-Dist: rich>=13.0.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: mypy>=1.13.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# Full-Stack FastAPI + Next.js Template for AI/LLM Applications
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<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>
|
|
41
|
+
<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>
|
|
42
|
+
<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>
|
|
43
|
+
<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>
|
|
44
|
+
<img src="https://img.shields.io/badge/coverage-100%25-brightgreen" alt="Coverage">
|
|
45
|
+
<img src="https://img.shields.io/badge/integrations-20%2B-brightgreen" alt="20+ Integrations">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<b>Production-ready project generator for AI/LLM applications with 20+ enterprise integrations.</b><br>
|
|
50
|
+
<sub>Built with FastAPI, Next.js 15, PydanticAI/LangChain, and everything you need for professional business applications.</sub>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<a href="#-why-this-template">Why This Template</a> •
|
|
55
|
+
<a href="#-features">Features</a> •
|
|
56
|
+
<a href="#-demo">Demo</a> •
|
|
57
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
58
|
+
<a href="#-architecture">Architecture</a> •
|
|
59
|
+
<a href="#-ai-agent">AI Agent</a> •
|
|
60
|
+
<a href="#-observability-with-logfire">Logfire</a> •
|
|
61
|
+
<a href="#-documentation">Documentation</a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
## Related Projects
|
|
65
|
+
|
|
66
|
+
> **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.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🎯 Why This Template
|
|
71
|
+
|
|
72
|
+
Building AI/LLM applications requires more than just an API wrapper. You need:
|
|
73
|
+
|
|
74
|
+
- **Type-safe AI agents** with tool/function calling
|
|
75
|
+
- **Real-time streaming** responses via WebSocket
|
|
76
|
+
- **Conversation persistence** and history management
|
|
77
|
+
- **Production infrastructure** - auth, rate limiting, observability
|
|
78
|
+
- **Enterprise integrations** - background tasks, webhooks, admin panels
|
|
79
|
+
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
### Perfect For
|
|
83
|
+
|
|
84
|
+
- 🤖 **AI Chatbots & Assistants** - PydanticAI or LangChain agents with streaming responses
|
|
85
|
+
- 📊 **ML Applications** - Background task processing with Celery/Taskiq
|
|
86
|
+
- 🏢 **Enterprise SaaS** - Full auth, admin panel, webhooks, and more
|
|
87
|
+
- 🚀 **Startups** - Ship fast with production-ready infrastructure
|
|
88
|
+
|
|
89
|
+
### AI-Agent Friendly
|
|
90
|
+
|
|
91
|
+
Generated projects include **CLAUDE.md** and **AGENTS.md** files optimized for AI coding assistants (Claude Code, Codex, Copilot, Cursor, Zed). Following [progressive disclosure](https://humanlayer.dev/blog/writing-a-good-claude-md) best practices - concise project overview with pointers to detailed docs when needed.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ✨ Features
|
|
96
|
+
|
|
97
|
+
### 🤖 AI/LLM First
|
|
98
|
+
|
|
99
|
+
- **[PydanticAI](https://ai.pydantic.dev)** or **[LangChain](https://python.langchain.com)** - Choose your preferred AI framework
|
|
100
|
+
- **WebSocket Streaming** - Real-time responses with full event access
|
|
101
|
+
- **Conversation Persistence** - Save chat history to database
|
|
102
|
+
- **Custom Tools** - Easily extend agent capabilities
|
|
103
|
+
- **Multi-provider Support** - OpenAI, Anthropic, OpenRouter
|
|
104
|
+
- **Observability** - Logfire for PydanticAI, LangSmith for LangChain
|
|
105
|
+
|
|
106
|
+
### ⚡ Backend (FastAPI)
|
|
107
|
+
|
|
108
|
+
- **[FastAPI](https://fastapi.tiangolo.com)** + **[Pydantic v2](https://docs.pydantic.dev)** - High-performance async API
|
|
109
|
+
- **Multiple Databases** - PostgreSQL (async), MongoDB (async), SQLite
|
|
110
|
+
- **Authentication** - JWT + Refresh tokens, API Keys, OAuth2 (Google)
|
|
111
|
+
- **Background Tasks** - Celery, Taskiq, or ARQ
|
|
112
|
+
- **Django-style CLI** - Custom management commands with auto-discovery
|
|
113
|
+
|
|
114
|
+
### 🎨 Frontend (Next.js 15)
|
|
115
|
+
|
|
116
|
+
- **React 19** + **TypeScript** + **Tailwind CSS v4**
|
|
117
|
+
- **AI Chat Interface** - WebSocket streaming, tool call visualization
|
|
118
|
+
- **Authentication** - HTTP-only cookies, auto-refresh
|
|
119
|
+
- **Dark Mode** + **i18n** (optional)
|
|
120
|
+
|
|
121
|
+
### 🔌 20+ Enterprise Integrations
|
|
122
|
+
|
|
123
|
+
| Category | Integrations |
|
|
124
|
+
|----------|-------------|
|
|
125
|
+
| **AI Frameworks** | PydanticAI, LangChain |
|
|
126
|
+
| **Caching & State** | Redis, fastapi-cache2 |
|
|
127
|
+
| **Security** | Rate limiting, CORS, CSRF protection |
|
|
128
|
+
| **Observability** | Logfire, LangSmith, Sentry, Prometheus |
|
|
129
|
+
| **Admin** | SQLAdmin panel with auth |
|
|
130
|
+
| **Events** | Webhooks, WebSockets |
|
|
131
|
+
| **DevOps** | Docker, GitHub Actions, GitLab CI, Kubernetes |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 🎬 Demo
|
|
136
|
+
|
|
137
|
+
<p align="center">
|
|
138
|
+
<img src="https://raw.githubusercontent.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/main/assets/app_start.gif" alt="FastAPI Fullstack Generator Demo">
|
|
139
|
+
</p>
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 🚀 Quick Start
|
|
144
|
+
|
|
145
|
+
### Installation
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# pip
|
|
149
|
+
pip install fastapi-fullstack
|
|
150
|
+
|
|
151
|
+
# uv (recommended)
|
|
152
|
+
uv tool install fastapi-fullstack
|
|
153
|
+
|
|
154
|
+
# pipx
|
|
155
|
+
pipx install fastapi-fullstack
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Create Your Project
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Interactive wizard (recommended)
|
|
162
|
+
fastapi-fullstack new
|
|
163
|
+
|
|
164
|
+
# Quick mode with options
|
|
165
|
+
fastapi-fullstack create my_ai_app \
|
|
166
|
+
--database postgresql \
|
|
167
|
+
--auth jwt \
|
|
168
|
+
--frontend nextjs
|
|
169
|
+
|
|
170
|
+
# Use presets for common setups
|
|
171
|
+
fastapi-fullstack create my_ai_app --preset production # Full production setup
|
|
172
|
+
fastapi-fullstack create my_ai_app --preset ai-agent # AI agent with streaming
|
|
173
|
+
|
|
174
|
+
# Minimal project (no extras)
|
|
175
|
+
fastapi-fullstack create my_ai_app --minimal
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Start Development
|
|
179
|
+
|
|
180
|
+
After generating your project, follow these steps:
|
|
181
|
+
|
|
182
|
+
#### 1. Install dependencies
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cd my_ai_app
|
|
186
|
+
make install
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### 2. Start the database
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# PostgreSQL (with Docker)
|
|
193
|
+
make docker-db
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### 3. Create and apply database migrations
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Create initial migration (first time only)
|
|
200
|
+
make db-migrate
|
|
201
|
+
# Enter message: "Initial migration"
|
|
202
|
+
|
|
203
|
+
# Apply migrations to create tables
|
|
204
|
+
make db-upgrade
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 4. Create admin user
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
make create-admin
|
|
211
|
+
# Enter email and password when prompted
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### 5. Start the backend
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
make run
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### 6. Start the frontend (new terminal)
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
cd frontend
|
|
224
|
+
bun install
|
|
225
|
+
bun dev
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Access:**
|
|
229
|
+
- API: http://localhost:8000
|
|
230
|
+
- Docs: http://localhost:8000/docs
|
|
231
|
+
- Admin Panel: http://localhost:8000/admin (login with admin user)
|
|
232
|
+
- Frontend: http://localhost:3000
|
|
233
|
+
|
|
234
|
+
### Quick Start with Docker
|
|
235
|
+
|
|
236
|
+
Run everything in Docker:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
make docker-up # Start backend + database
|
|
240
|
+
make docker-frontend # Start frontend
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Using the Project CLI
|
|
244
|
+
|
|
245
|
+
Each generated project has a CLI named after your `project_slug`. For example, if you created `my_ai_app`:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
cd backend
|
|
249
|
+
|
|
250
|
+
# The CLI command is: uv run <project_slug> <command>
|
|
251
|
+
uv run my_ai_app server run --reload # Start dev server
|
|
252
|
+
uv run my_ai_app db migrate -m "message" # Create migration
|
|
253
|
+
uv run my_ai_app db upgrade # Apply migrations
|
|
254
|
+
uv run my_ai_app user create-admin # Create admin user
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Use `make help` to see all available Makefile shortcuts.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 📸 Screenshots
|
|
262
|
+
|
|
263
|
+
### Chat Interface
|
|
264
|
+
| Light Mode | Dark Mode |
|
|
265
|
+
|:---:|:---:|
|
|
266
|
+
|  |  |
|
|
267
|
+
|
|
268
|
+
### Authentication
|
|
269
|
+
| Register | Login |
|
|
270
|
+
|:---:|:---:|
|
|
271
|
+
|  |  |
|
|
272
|
+
|
|
273
|
+
### Observability
|
|
274
|
+
| Logfire (PydanticAI) | LangSmith (LangChain) |
|
|
275
|
+
|:---:|:---:|
|
|
276
|
+
|  |  |
|
|
277
|
+
|
|
278
|
+
### Admin, Monitoring & API
|
|
279
|
+
| Celery Flower | SQLAdmin Panel |
|
|
280
|
+
|:---:|:---:|
|
|
281
|
+
|  |  |
|
|
282
|
+
|
|
283
|
+
| API Documentation |
|
|
284
|
+
|:---:|
|
|
285
|
+
|  |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 🏗️ Architecture
|
|
290
|
+
|
|
291
|
+
```mermaid
|
|
292
|
+
graph TB
|
|
293
|
+
subgraph Frontend["Frontend (Next.js 15)"]
|
|
294
|
+
UI[React Components]
|
|
295
|
+
WS[WebSocket Client]
|
|
296
|
+
Store[Zustand Stores]
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
subgraph Backend["Backend (FastAPI)"]
|
|
300
|
+
API[API Routes]
|
|
301
|
+
Services[Services Layer]
|
|
302
|
+
Repos[Repositories]
|
|
303
|
+
Agent[AI Agent]
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
subgraph Infrastructure
|
|
307
|
+
DB[(PostgreSQL/MongoDB)]
|
|
308
|
+
Redis[(Redis)]
|
|
309
|
+
Queue[Celery/Taskiq]
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
subgraph External
|
|
313
|
+
LLM[OpenAI/Anthropic]
|
|
314
|
+
Webhook[Webhook Endpoints]
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
UI --> API
|
|
318
|
+
WS <--> Agent
|
|
319
|
+
API --> Services
|
|
320
|
+
Services --> Repos
|
|
321
|
+
Services --> Agent
|
|
322
|
+
Repos --> DB
|
|
323
|
+
Agent --> LLM
|
|
324
|
+
Services --> Redis
|
|
325
|
+
Services --> Queue
|
|
326
|
+
Services --> Webhook
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Layered Architecture
|
|
330
|
+
|
|
331
|
+
The backend follows a clean **Repository + Service** pattern:
|
|
332
|
+
|
|
333
|
+
```mermaid
|
|
334
|
+
graph LR
|
|
335
|
+
A[API Routes] --> B[Services]
|
|
336
|
+
B --> C[Repositories]
|
|
337
|
+
C --> D[(Database)]
|
|
338
|
+
|
|
339
|
+
B --> E[External APIs]
|
|
340
|
+
B --> F[AI Agents]
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
| Layer | Responsibility |
|
|
344
|
+
|-------|---------------|
|
|
345
|
+
| **Routes** | HTTP handling, validation, auth |
|
|
346
|
+
| **Services** | Business logic, orchestration |
|
|
347
|
+
| **Repositories** | Data access, queries |
|
|
348
|
+
|
|
349
|
+
See [Architecture Documentation](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md) for details.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 🤖 AI Agent
|
|
354
|
+
|
|
355
|
+
Choose between **PydanticAI** or **LangChain** when generating your project, with support for multiple LLM providers:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# PydanticAI with OpenAI (default)
|
|
359
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai
|
|
360
|
+
|
|
361
|
+
# PydanticAI with Anthropic
|
|
362
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai --llm-provider anthropic
|
|
363
|
+
|
|
364
|
+
# PydanticAI with OpenRouter
|
|
365
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework pydantic_ai --llm-provider openrouter
|
|
366
|
+
|
|
367
|
+
# LangChain with OpenAI
|
|
368
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework langchain
|
|
369
|
+
|
|
370
|
+
# LangChain with Anthropic
|
|
371
|
+
fastapi-fullstack create my_app --ai-agent --ai-framework langchain --llm-provider anthropic
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Supported LLM Providers
|
|
375
|
+
|
|
376
|
+
| Framework | OpenAI | Anthropic | OpenRouter |
|
|
377
|
+
|-----------|:------:|:---------:|:----------:|
|
|
378
|
+
| **PydanticAI** | ✓ | ✓ | ✓ |
|
|
379
|
+
| **LangChain** | ✓ | ✓ | - |
|
|
380
|
+
|
|
381
|
+
### PydanticAI Integration
|
|
382
|
+
|
|
383
|
+
Type-safe agents with full dependency injection:
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
# app/agents/assistant.py
|
|
387
|
+
from pydantic_ai import Agent, RunContext
|
|
388
|
+
|
|
389
|
+
@dataclass
|
|
390
|
+
class Deps:
|
|
391
|
+
user_id: str | None = None
|
|
392
|
+
db: AsyncSession | None = None
|
|
393
|
+
|
|
394
|
+
agent = Agent[Deps, str](
|
|
395
|
+
model="openai:gpt-4o-mini",
|
|
396
|
+
system_prompt="You are a helpful assistant.",
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
@agent.tool
|
|
400
|
+
async def search_database(ctx: RunContext[Deps], query: str) -> list[dict]:
|
|
401
|
+
"""Search the database for relevant information."""
|
|
402
|
+
# Access user context and database via ctx.deps
|
|
403
|
+
...
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### LangChain Integration
|
|
407
|
+
|
|
408
|
+
Flexible agents with LangGraph:
|
|
409
|
+
|
|
410
|
+
```python
|
|
411
|
+
# app/agents/langchain_assistant.py
|
|
412
|
+
from langchain.tools import tool
|
|
413
|
+
from langgraph.prebuilt import create_react_agent
|
|
414
|
+
|
|
415
|
+
@tool
|
|
416
|
+
def search_database(query: str) -> list[dict]:
|
|
417
|
+
"""Search the database for relevant information."""
|
|
418
|
+
...
|
|
419
|
+
|
|
420
|
+
agent = create_react_agent(
|
|
421
|
+
model=ChatOpenAI(model="gpt-4o-mini"),
|
|
422
|
+
tools=[search_database],
|
|
423
|
+
prompt="You are a helpful assistant.",
|
|
424
|
+
)
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### WebSocket Streaming
|
|
428
|
+
|
|
429
|
+
Both frameworks use the same WebSocket endpoint with real-time streaming:
|
|
430
|
+
|
|
431
|
+
```python
|
|
432
|
+
@router.websocket("/ws")
|
|
433
|
+
async def agent_ws(websocket: WebSocket):
|
|
434
|
+
await websocket.accept()
|
|
435
|
+
|
|
436
|
+
# Works with both PydanticAI and LangChain
|
|
437
|
+
async for event in agent.stream(user_input):
|
|
438
|
+
await websocket.send_json({
|
|
439
|
+
"type": "text_delta",
|
|
440
|
+
"content": event.content
|
|
441
|
+
})
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Observability
|
|
445
|
+
|
|
446
|
+
Each framework has its own observability solution:
|
|
447
|
+
|
|
448
|
+
| Framework | Observability | Dashboard |
|
|
449
|
+
|-----------|--------------|-----------|
|
|
450
|
+
| **PydanticAI** | [Logfire](https://logfire.pydantic.dev) | Agent runs, tool calls, token usage |
|
|
451
|
+
| **LangChain** | [LangSmith](https://smith.langchain.com) | Traces, feedback, datasets |
|
|
452
|
+
|
|
453
|
+
See [AI Agent Documentation](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/ai-agent.md) for more.
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## 📊 Observability
|
|
458
|
+
|
|
459
|
+
### Logfire (for PydanticAI)
|
|
460
|
+
|
|
461
|
+
[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.
|
|
462
|
+
|
|
463
|
+
```mermaid
|
|
464
|
+
graph LR
|
|
465
|
+
subgraph Your App
|
|
466
|
+
API[FastAPI]
|
|
467
|
+
Agent[PydanticAI]
|
|
468
|
+
DB[(Database)]
|
|
469
|
+
Cache[(Redis)]
|
|
470
|
+
Queue[Celery/Taskiq]
|
|
471
|
+
HTTP[HTTPX]
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
subgraph Logfire
|
|
475
|
+
Traces[Traces]
|
|
476
|
+
Metrics[Metrics]
|
|
477
|
+
Logs[Logs]
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
API --> Traces
|
|
481
|
+
Agent --> Traces
|
|
482
|
+
DB --> Traces
|
|
483
|
+
Cache --> Traces
|
|
484
|
+
Queue --> Traces
|
|
485
|
+
HTTP --> Traces
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
| Component | What You See |
|
|
489
|
+
|-----------|-------------|
|
|
490
|
+
| **PydanticAI** | Agent runs, tool calls, LLM requests, token usage, streaming events |
|
|
491
|
+
| **FastAPI** | Request/response traces, latency, status codes, route performance |
|
|
492
|
+
| **PostgreSQL/MongoDB** | Query execution time, slow queries, connection pool stats |
|
|
493
|
+
| **Redis** | Cache hits/misses, command latency, key patterns |
|
|
494
|
+
| **Celery/Taskiq** | Task execution, queue depth, worker performance |
|
|
495
|
+
| **HTTPX** | External API calls, response times, error rates |
|
|
496
|
+
|
|
497
|
+
### LangSmith (for LangChain)
|
|
498
|
+
|
|
499
|
+
[LangSmith](https://smith.langchain.com) provides observability specifically designed for LangChain applications:
|
|
500
|
+
|
|
501
|
+
| Feature | Description |
|
|
502
|
+
|---------|-------------|
|
|
503
|
+
| **Traces** | Full execution traces for agent runs and chains |
|
|
504
|
+
| **Feedback** | Collect user feedback on agent responses |
|
|
505
|
+
| **Datasets** | Build evaluation datasets from production data |
|
|
506
|
+
| **Monitoring** | Track latency, errors, and token usage |
|
|
507
|
+
|
|
508
|
+
LangSmith is automatically configured when you choose LangChain:
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
# .env
|
|
512
|
+
LANGCHAIN_TRACING_V2=true
|
|
513
|
+
LANGCHAIN_API_KEY=your-api-key
|
|
514
|
+
LANGCHAIN_PROJECT=my_project
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Configuration
|
|
518
|
+
|
|
519
|
+
Enable Logfire and select which components to instrument:
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
fastapi-fullstack new
|
|
523
|
+
# ✓ Enable Logfire observability
|
|
524
|
+
# ✓ Instrument FastAPI
|
|
525
|
+
# ✓ Instrument Database
|
|
526
|
+
# ✓ Instrument Redis
|
|
527
|
+
# ✓ Instrument Celery
|
|
528
|
+
# ✓ Instrument HTTPX
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### Usage
|
|
532
|
+
|
|
533
|
+
```python
|
|
534
|
+
# Automatic instrumentation in app/main.py
|
|
535
|
+
import logfire
|
|
536
|
+
|
|
537
|
+
logfire.configure()
|
|
538
|
+
logfire.instrument_fastapi(app)
|
|
539
|
+
logfire.instrument_asyncpg()
|
|
540
|
+
logfire.instrument_redis()
|
|
541
|
+
logfire.instrument_httpx()
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
```python
|
|
545
|
+
# Manual spans for custom logic
|
|
546
|
+
with logfire.span("process_order", order_id=order.id):
|
|
547
|
+
await validate_order(order)
|
|
548
|
+
await charge_payment(order)
|
|
549
|
+
await send_confirmation(order)
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
For more details, see [Logfire Documentation](https://logfire.pydantic.dev/docs/integrations/).
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
## 🛠️ Django-style CLI
|
|
557
|
+
|
|
558
|
+
Each generated project includes a powerful CLI inspired by Django's management commands:
|
|
559
|
+
|
|
560
|
+
### Built-in Commands
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# Server
|
|
564
|
+
my_app server run --reload
|
|
565
|
+
my_app server routes
|
|
566
|
+
|
|
567
|
+
# Database (Alembic wrapper)
|
|
568
|
+
my_app db init
|
|
569
|
+
my_app db migrate -m "Add users"
|
|
570
|
+
my_app db upgrade
|
|
571
|
+
|
|
572
|
+
# Users
|
|
573
|
+
my_app user create --email admin@example.com --superuser
|
|
574
|
+
my_app user list
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Custom Commands
|
|
578
|
+
|
|
579
|
+
Create your own commands with auto-discovery:
|
|
580
|
+
|
|
581
|
+
```python
|
|
582
|
+
# app/commands/seed.py
|
|
583
|
+
from app.commands import command, success, error
|
|
584
|
+
import click
|
|
585
|
+
|
|
586
|
+
@command("seed", help="Seed database with test data")
|
|
587
|
+
@click.option("--count", "-c", default=10, type=int)
|
|
588
|
+
@click.option("--dry-run", is_flag=True)
|
|
589
|
+
def seed_database(count: int, dry_run: bool):
|
|
590
|
+
"""Seed the database with sample data."""
|
|
591
|
+
if dry_run:
|
|
592
|
+
info(f"[DRY RUN] Would create {count} records")
|
|
593
|
+
return
|
|
594
|
+
|
|
595
|
+
# Your logic here
|
|
596
|
+
success(f"Created {count} records!")
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Commands are **automatically discovered** from `app/commands/` - just create a file and use the `@command` decorator.
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
my_app cmd seed --count 100
|
|
603
|
+
my_app cmd seed --dry-run
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## 📁 Generated Project Structure
|
|
609
|
+
|
|
610
|
+
```
|
|
611
|
+
my_project/
|
|
612
|
+
├── backend/
|
|
613
|
+
│ ├── app/
|
|
614
|
+
│ │ ├── main.py # FastAPI app with lifespan
|
|
615
|
+
│ │ ├── api/
|
|
616
|
+
│ │ │ ├── routes/v1/ # Versioned API endpoints
|
|
617
|
+
│ │ │ ├── deps.py # Dependency injection
|
|
618
|
+
│ │ │ └── router.py # Route aggregation
|
|
619
|
+
│ │ ├── core/ # Config, security, middleware
|
|
620
|
+
│ │ ├── db/models/ # SQLAlchemy/MongoDB models
|
|
621
|
+
│ │ ├── schemas/ # Pydantic schemas
|
|
622
|
+
│ │ ├── repositories/ # Data access layer
|
|
623
|
+
│ │ ├── services/ # Business logic
|
|
624
|
+
│ │ ├── agents/ # AI agents with centralized prompts
|
|
625
|
+
│ │ ├── commands/ # Django-style CLI commands
|
|
626
|
+
│ │ └── worker/ # Background tasks
|
|
627
|
+
│ ├── cli/ # Project CLI
|
|
628
|
+
│ ├── tests/ # pytest test suite
|
|
629
|
+
│ └── alembic/ # Database migrations
|
|
630
|
+
├── frontend/
|
|
631
|
+
│ ├── src/
|
|
632
|
+
│ │ ├── app/ # Next.js App Router
|
|
633
|
+
│ │ ├── components/ # React components
|
|
634
|
+
│ │ ├── hooks/ # useChat, useWebSocket, etc.
|
|
635
|
+
│ │ └── stores/ # Zustand state management
|
|
636
|
+
│ └── e2e/ # Playwright tests
|
|
637
|
+
├── docker-compose.yml
|
|
638
|
+
├── Makefile
|
|
639
|
+
└── README.md
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
Generated projects include version metadata in `pyproject.toml` for tracking:
|
|
643
|
+
|
|
644
|
+
```toml
|
|
645
|
+
[tool.fastapi-fullstack]
|
|
646
|
+
generator_version = "0.1.5"
|
|
647
|
+
generated_at = "2024-12-21T10:30:00+00:00"
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
---
|
|
651
|
+
|
|
652
|
+
## ⚙️ Configuration Options
|
|
653
|
+
|
|
654
|
+
### Core Options
|
|
655
|
+
|
|
656
|
+
| Option | Values | Description |
|
|
657
|
+
|--------|--------|-------------|
|
|
658
|
+
| **Database** | `postgresql`, `mongodb`, `sqlite`, `none` | Async by default |
|
|
659
|
+
| **Auth** | `jwt`, `api_key`, `both`, `none` | JWT includes user management |
|
|
660
|
+
| **OAuth** | `none`, `google` | Social login |
|
|
661
|
+
| **AI Framework** | `pydantic_ai`, `langchain` | Choose your AI agent framework |
|
|
662
|
+
| **LLM Provider** | `openai`, `anthropic`, `openrouter` | OpenRouter only with PydanticAI |
|
|
663
|
+
| **Background Tasks** | `none`, `celery`, `taskiq`, `arq` | Distributed queues |
|
|
664
|
+
| **Frontend** | `none`, `nextjs` | Next.js 15 + React 19 |
|
|
665
|
+
|
|
666
|
+
### Presets
|
|
667
|
+
|
|
668
|
+
| Preset | Description |
|
|
669
|
+
|--------|-------------|
|
|
670
|
+
| `--preset production` | Full production setup with Redis, Sentry, Kubernetes, Prometheus |
|
|
671
|
+
| `--preset ai-agent` | AI agent with WebSocket streaming and conversation persistence |
|
|
672
|
+
| `--minimal` | Minimal project with no extras |
|
|
673
|
+
|
|
674
|
+
### Integrations
|
|
675
|
+
|
|
676
|
+
Select what you need:
|
|
677
|
+
|
|
678
|
+
```bash
|
|
679
|
+
fastapi-fullstack new
|
|
680
|
+
# ✓ Redis (caching/sessions)
|
|
681
|
+
# ✓ Rate limiting (slowapi)
|
|
682
|
+
# ✓ Pagination (fastapi-pagination)
|
|
683
|
+
# ✓ Admin Panel (SQLAdmin)
|
|
684
|
+
# ✓ AI Agent (PydanticAI or LangChain)
|
|
685
|
+
# ✓ Webhooks
|
|
686
|
+
# ✓ Sentry
|
|
687
|
+
# ✓ Logfire / LangSmith
|
|
688
|
+
# ✓ Prometheus
|
|
689
|
+
# ... and more
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## 📚 Documentation
|
|
695
|
+
|
|
696
|
+
| Document | Description |
|
|
697
|
+
|----------|-------------|
|
|
698
|
+
| [Architecture](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/architecture.md) | Repository + Service pattern, layered design |
|
|
699
|
+
| [Frontend](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/frontend.md) | Next.js setup, auth, state management |
|
|
700
|
+
| [AI Agent](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/ai-agent.md) | PydanticAI, tools, WebSocket streaming |
|
|
701
|
+
| [Observability](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/observability.md) | Logfire integration, tracing, metrics |
|
|
702
|
+
| [Deployment](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/deployment.md) | Docker, Kubernetes, production setup |
|
|
703
|
+
| [Development](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/development.md) | Local setup, testing, debugging |
|
|
704
|
+
| [Changelog](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/CHANGELOG.md) | Version history and release notes |
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## Star History
|
|
709
|
+
|
|
710
|
+
[](https://www.star-history.com/#vstorm-co/full-stack-fastapi-nextjs-llm-template&type=date&legend=top-left)
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
## 🙏 Inspiration
|
|
715
|
+
|
|
716
|
+
This project is inspired by:
|
|
717
|
+
|
|
718
|
+
- [full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template) by @tiangolo
|
|
719
|
+
- [fastapi-template](https://github.com/s3rius/fastapi-template) by @s3rius
|
|
720
|
+
- [FastAPI Best Practices](https://github.com/zhanymkanov/fastapi-best-practices) by @zhanymkanov
|
|
721
|
+
- Django's management commands system
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## 🤝 Contributing
|
|
726
|
+
|
|
727
|
+
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.
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
## 📄 License
|
|
732
|
+
|
|
733
|
+
MIT License - see [LICENSE](https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/LICENSE) for details.
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
737
|
+
<p align="center">
|
|
738
|
+
Made with ❤️ by <a href="https://github.com/vstorm-co">VStorm</a>
|
|
739
|
+
</p>
|