phos 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/AGENTS.md +172 -0
- package/CHANGELOG.md +184 -0
- package/LICENSE +21 -0
- package/README.md +279 -0
- package/bun.lock +125 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +255 -0
- package/dist/cli.js.map +1 -0
- package/dist/generators/backends/elysia.d.ts +3 -0
- package/dist/generators/backends/elysia.d.ts.map +1 -0
- package/dist/generators/backends/elysia.js +135 -0
- package/dist/generators/backends/elysia.js.map +1 -0
- package/dist/generators/backends/fastapi.d.ts +3 -0
- package/dist/generators/backends/fastapi.d.ts.map +1 -0
- package/dist/generators/backends/fastapi.js +158 -0
- package/dist/generators/backends/fastapi.js.map +1 -0
- package/dist/generators/frontends/astro.d.ts +3 -0
- package/dist/generators/frontends/astro.d.ts.map +1 -0
- package/dist/generators/frontends/astro.js +303 -0
- package/dist/generators/frontends/astro.js.map +1 -0
- package/dist/generators/frontends/nextjs.d.ts +3 -0
- package/dist/generators/frontends/nextjs.d.ts.map +1 -0
- package/dist/generators/frontends/nextjs.js +274 -0
- package/dist/generators/frontends/nextjs.js.map +1 -0
- package/dist/generators/frontends/svelte.d.ts +3 -0
- package/dist/generators/frontends/svelte.d.ts.map +1 -0
- package/dist/generators/frontends/svelte.js +324 -0
- package/dist/generators/frontends/svelte.js.map +1 -0
- package/dist/generators/monorepo.d.ts +3 -0
- package/dist/generators/monorepo.d.ts.map +1 -0
- package/dist/generators/monorepo.js +320 -0
- package/dist/generators/monorepo.js.map +1 -0
- package/dist/generators/single.d.ts +3 -0
- package/dist/generators/single.d.ts.map +1 -0
- package/dist/generators/single.js +229 -0
- package/dist/generators/single.js.map +1 -0
- package/dist/utils/helpers.d.ts +38 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +109 -0
- package/dist/utils/helpers.js.map +1 -0
- package/package.json +46 -0
- package/src/cli.ts +500 -0
- package/src/generators/backends/elysia.ts +45 -0
- package/src/generators/backends/fastapi.ts +71 -0
- package/src/generators/frontends/astro.ts +37 -0
- package/src/generators/frontends/nextjs.ts +37 -0
- package/src/generators/frontends/svelte.ts +38 -0
- package/src/generators/monorepo.ts +529 -0
- package/src/generators/single.ts +465 -0
- package/src/templates/backend/elysia/README.md +15 -0
- package/src/templates/backend/elysia/package.json +26 -0
- package/src/templates/backend/elysia/src/api/user_api.ts +0 -0
- package/src/templates/backend/elysia/src/db.ts +17 -0
- package/src/templates/backend/elysia/src/index.ts +68 -0
- package/src/templates/backend/elysia/src/service/user_service.ts +0 -0
- package/src/templates/backend/elysia/src/sql/user_sql.ts +0 -0
- package/src/templates/backend/elysia/src/types/user_type.ts +0 -0
- package/src/templates/backend/elysia/tsconfig.json +103 -0
- package/src/templates/backend/fastapi/.pylintrc +2 -0
- package/src/templates/backend/fastapi/README.md +33 -0
- package/src/templates/backend/fastapi/pyproject.toml +9 -0
- package/src/templates/backend/fastapi/pyproject_prettier.toml +20 -0
- package/src/templates/backend/fastapi/requirements.txt +15 -0
- package/src/templates/backend/fastapi/setup.sh +23 -0
- package/src/templates/backend/fastapi/src/api/user_api.py +0 -0
- package/src/templates/backend/fastapi/src/db.py +31 -0
- package/src/templates/backend/fastapi/src/main.py +53 -0
- package/src/templates/backend/fastapi/src/service/user_service.py +0 -0
- package/src/templates/backend/fastapi/src/sql/user_sql.py +0 -0
- package/src/templates/backend/fastapi/src/types/user_type.py +0 -0
- package/src/templates/frontend/astro/README.md +46 -0
- package/src/templates/frontend/astro/astro.config.mjs +5 -0
- package/src/templates/frontend/astro/package.json +28 -0
- package/src/templates/frontend/astro/public/favicon.ico +0 -0
- package/src/templates/frontend/astro/public/favicon.svg +9 -0
- package/src/templates/frontend/astro/src/assets/astro.svg +1 -0
- package/src/templates/frontend/astro/src/assets/background.svg +1 -0
- package/src/templates/frontend/astro/src/components/Welcome.astro +5 -0
- package/src/templates/frontend/astro/src/layouts/Layout.astro +23 -0
- package/src/templates/frontend/astro/src/pages/index.astro +8 -0
- package/src/templates/frontend/astro/tsconfig.json +5 -0
- package/src/templates/frontend/nextjs/README.md +36 -0
- package/src/templates/frontend/nextjs/app/favicon.ico +0 -0
- package/src/templates/frontend/nextjs/app/globals.css +26 -0
- package/src/templates/frontend/nextjs/app/layout.tsx +34 -0
- package/src/templates/frontend/nextjs/app/page.tsx +16 -0
- package/src/templates/frontend/nextjs/eslint.config.mjs +18 -0
- package/src/templates/frontend/nextjs/next.config.ts +7 -0
- package/src/templates/frontend/nextjs/package.json +28 -0
- package/src/templates/frontend/nextjs/postcss.config.mjs +7 -0
- package/src/templates/frontend/nextjs/public/file.svg +1 -0
- package/src/templates/frontend/nextjs/public/globe.svg +1 -0
- package/src/templates/frontend/nextjs/public/next.svg +1 -0
- package/src/templates/frontend/nextjs/public/vercel.svg +1 -0
- package/src/templates/frontend/nextjs/public/window.svg +1 -0
- package/src/templates/frontend/nextjs/tsconfig.json +34 -0
- package/src/templates/frontend/svelte/.prettierignore +9 -0
- package/src/templates/frontend/svelte/.prettierrc +19 -0
- package/src/templates/frontend/svelte/README.md +42 -0
- package/src/templates/frontend/svelte/eslint.config.js +39 -0
- package/src/templates/frontend/svelte/package.json +39 -0
- package/src/templates/frontend/svelte/src/app.d.ts +13 -0
- package/src/templates/frontend/svelte/src/app.html +11 -0
- package/src/templates/frontend/svelte/src/lib/assets/favicon.svg +1 -0
- package/src/templates/frontend/svelte/src/lib/index.ts +1 -0
- package/src/templates/frontend/svelte/src/routes/+layout.svelte +9 -0
- package/src/templates/frontend/svelte/src/routes/+page.svelte +2 -0
- package/src/templates/frontend/svelte/src/routes/layout.css +2 -0
- package/src/templates/frontend/svelte/static/robots.txt +3 -0
- package/src/templates/frontend/svelte/svelte.config.js +13 -0
- package/src/templates/frontend/svelte/tsconfig.json +20 -0
- package/src/templates/frontend/svelte/vite.config.ts +5 -0
- package/src/utils/helpers.ts +198 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "ES2022", /* Specify what module code is generated. */
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
"types": ["bun-types"], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
39
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
+
|
|
41
|
+
/* JavaScript Support */
|
|
42
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
43
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
44
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
45
|
+
|
|
46
|
+
/* Emit */
|
|
47
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
52
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
53
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
54
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
57
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
58
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
59
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
61
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
+
|
|
71
|
+
/* Interop Constraints */
|
|
72
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
73
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
75
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
77
|
+
|
|
78
|
+
/* Type Checking */
|
|
79
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
80
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
84
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
86
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
87
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
88
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
89
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
90
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
91
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
92
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
93
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
94
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
96
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
98
|
+
|
|
99
|
+
/* Completeness */
|
|
100
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# FastAPI Backend
|
|
2
|
+
|
|
3
|
+
Generated by [Phos](https://github.com/yourusername/phos).
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install dependencies
|
|
9
|
+
pip install -r requirements.txt
|
|
10
|
+
|
|
11
|
+
# Run development server
|
|
12
|
+
uvicorn src.main:app --reload --port 8000
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## API Documentation
|
|
16
|
+
|
|
17
|
+
Once server is running, visit:
|
|
18
|
+
- Swagger UI: http://localhost:8000/docs
|
|
19
|
+
- ReDoc: http://localhost:8000/redoc
|
|
20
|
+
|
|
21
|
+
## Available Scripts
|
|
22
|
+
|
|
23
|
+
- `uvicorn src.main:app --reload` - Start development server
|
|
24
|
+
- `uvicorn src.main:app` - Start production server{{#if backend.eslint}}
|
|
25
|
+
- `pylint src` - Run linter{{/if}}{{#if backend.prettier}}
|
|
26
|
+
- `black src` - Format code{{/if}}
|
|
27
|
+
|
|
28
|
+
## Tech Stack
|
|
29
|
+
|
|
30
|
+
- Framework: FastAPI
|
|
31
|
+
- Python: 3.10+
|
|
32
|
+
- ESLint: {{#if backend.eslint}}Yes{{else}}No{{/if}}
|
|
33
|
+
- Prettier (Black): {{#if backend.prettier}}Yes{{else}}No{{/if}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[tool.black]
|
|
2
|
+
line-length = 88
|
|
3
|
+
target-version = ['py310']
|
|
4
|
+
include = '\.pyi?$'
|
|
5
|
+
extend-exclude = '''
|
|
6
|
+
/(
|
|
7
|
+
# directories
|
|
8
|
+
\.eggs
|
|
9
|
+
| \.git
|
|
10
|
+
| \.hg
|
|
11
|
+
| \.mypy_cache
|
|
12
|
+
| \.tox
|
|
13
|
+
| \.venv
|
|
14
|
+
| build
|
|
15
|
+
| dist
|
|
16
|
+
)/
|
|
17
|
+
'''
|
|
18
|
+
|
|
19
|
+
[tool.isort]
|
|
20
|
+
profile = "black"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
fastapi>=0.104.0
|
|
2
|
+
uvicorn[standard]>=0.24.0
|
|
3
|
+
pydantic>=2.0.0
|
|
4
|
+
python-multipart>=0.0.6
|
|
5
|
+
python-dotenv>=1.0.0
|
|
6
|
+
sqlalchemy>=2.0.0
|
|
7
|
+
psycopg2-binary>=2.9.0
|
|
8
|
+
python-jose[cryptography]>=3.3.0
|
|
9
|
+
passlib[bcrypt]>=1.7.4
|
|
10
|
+
{{#if backend.eslint}}
|
|
11
|
+
pylint>=3.0.0
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if backend.prettier}}
|
|
14
|
+
black>=23.0.0
|
|
15
|
+
{{/if}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
echo "🔧 Setting up Python virtual environment for {{projectName}}..."
|
|
4
|
+
|
|
5
|
+
# Create virtual environment
|
|
6
|
+
python3 -m venv venv
|
|
7
|
+
|
|
8
|
+
echo "✅ Virtual environment created"
|
|
9
|
+
|
|
10
|
+
# Activate and install dependencies
|
|
11
|
+
source venv/bin/activate
|
|
12
|
+
pip install --upgrade pip
|
|
13
|
+
pip install -r requirements.txt
|
|
14
|
+
|
|
15
|
+
echo "✅ Dependencies installed"
|
|
16
|
+
echo ""
|
|
17
|
+
echo "🚀 Setup complete!"
|
|
18
|
+
echo ""
|
|
19
|
+
echo "To activate the virtual environment, run:"
|
|
20
|
+
echo " source venv/bin/activate"
|
|
21
|
+
echo ""
|
|
22
|
+
echo "To run the application:"
|
|
23
|
+
echo " python src/main.py"
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from sqlalchemy import create_engine
|
|
2
|
+
from sqlalchemy.ext.declarative import declarative_base
|
|
3
|
+
from sqlalchemy.orm import sessionmaker
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
DATABASE_URL = (
|
|
7
|
+
f"postgresql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}"
|
|
8
|
+
f"@{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}"
|
|
9
|
+
f"/{os.getenv('DB_NAME')}"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
engine = create_engine(
|
|
13
|
+
DATABASE_URL,
|
|
14
|
+
pool_pre_ping=True,
|
|
15
|
+
echo=os.getenv("DEBUG") == "true"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
19
|
+
|
|
20
|
+
Base = declarative_base()
|
|
21
|
+
|
|
22
|
+
def get_db():
|
|
23
|
+
db = SessionLocal()
|
|
24
|
+
try:
|
|
25
|
+
yield db
|
|
26
|
+
finally:
|
|
27
|
+
db.close()
|
|
28
|
+
|
|
29
|
+
print(f"🗄️ Database connected to: {os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('DB_NAME')}")
|
|
30
|
+
|
|
31
|
+
__all__ = ["Base"]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from fastapi import FastAPI
|
|
2
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
3
|
+
from fastapi import Depends, HTTPException, status
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
import os
|
|
6
|
+
from dotenv import load_dotenv
|
|
7
|
+
from sqlalchemy import create_engine
|
|
8
|
+
from sqlalchemy.orm import sessionmaker
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
load_dotenv()
|
|
12
|
+
|
|
13
|
+
API_KEY = os.getenv("X_API_KEY", "1234")
|
|
14
|
+
CORS_ALLOWED_ORIGINS = os.getenv("CORS_ALLOWED_ORIGINS", "http://localhost:4200").split(",")
|
|
15
|
+
|
|
16
|
+
app = FastAPI(
|
|
17
|
+
title="{{projectName}} API",
|
|
18
|
+
description="A modern web application API built with FastAPI",
|
|
19
|
+
version="1.0.0",
|
|
20
|
+
docs_url="/w",
|
|
21
|
+
redoc_url="/redoc"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
app.add_middleware(
|
|
25
|
+
CORSMiddleware,
|
|
26
|
+
allow_origins=CORS_ALLOWED_ORIGINS,
|
|
27
|
+
allow_credentials=True,
|
|
28
|
+
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
29
|
+
allow_headers=["Content-Type", "Authorization", "X-API-Key"],
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
@app.get("/health")
|
|
33
|
+
async def health_check():
|
|
34
|
+
return {
|
|
35
|
+
"status": "ok",
|
|
36
|
+
"timestamp": datetime.now().isoformat()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async def verify_api_key(x_api_key: Optional[str] = None):
|
|
40
|
+
if x_api_key != API_KEY:
|
|
41
|
+
raise HTTPException(
|
|
42
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
43
|
+
detail="Unauthorized: Invalid or missing API key"
|
|
44
|
+
)
|
|
45
|
+
return x_api_key
|
|
46
|
+
|
|
47
|
+
@app.get("/")
|
|
48
|
+
async def root():
|
|
49
|
+
return {"message": f"Hello FastAPI {{projectName}}"}
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
import uvicorn
|
|
53
|
+
uvicorn.run(app, host="0.0.0.0", port=4100)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Astro Starter Kit: Basics
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
npm create astro@latest -- --template basics
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
|
8
|
+
|
|
9
|
+
## 🚀 Project Structure
|
|
10
|
+
|
|
11
|
+
Inside of your Astro project, you'll see the following folders and files:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
/
|
|
15
|
+
├── public/
|
|
16
|
+
│ └── favicon.svg
|
|
17
|
+
├── src
|
|
18
|
+
│ ├── assets
|
|
19
|
+
│ │ └── astro.svg
|
|
20
|
+
│ ├── components
|
|
21
|
+
│ │ └── Welcome.astro
|
|
22
|
+
│ ├── layouts
|
|
23
|
+
│ │ └── Layout.astro
|
|
24
|
+
│ └── pages
|
|
25
|
+
│ └── index.astro
|
|
26
|
+
└── package.json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/).
|
|
30
|
+
|
|
31
|
+
## 🧞 Commands
|
|
32
|
+
|
|
33
|
+
All commands are run from the root of the project, from a terminal:
|
|
34
|
+
|
|
35
|
+
| Command | Action |
|
|
36
|
+
| :------------------------ | :----------------------------------------------- |
|
|
37
|
+
| `npm install` | Installs dependencies |
|
|
38
|
+
| `npm run dev` | Starts local dev server at `localhost:4321` |
|
|
39
|
+
| `npm run build` | Build your production site to `./dist/` |
|
|
40
|
+
| `npm run preview` | Preview your build locally, before deploying |
|
|
41
|
+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
|
42
|
+
| `npm run astro -- --help` | Get help using the Astro CLI |
|
|
43
|
+
|
|
44
|
+
## 👀 Want to learn more?
|
|
45
|
+
|
|
46
|
+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{#if (eq projectType 'monorepo')}}frontend{{else}}{{projectName}}{{/if}}",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "astro dev",
|
|
7
|
+
"build": "astro build",
|
|
8
|
+
"preview": "astro preview",
|
|
9
|
+
"astro": "astro"{{#if frontend.eslint}},
|
|
10
|
+
"lint": "eslint ."{{/if}}{{#if frontend.prettier}},
|
|
11
|
+
"format": "prettier --write ."{{/if}}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"astro": "^5.17.1"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@astrojs/check": "^0.9.4",
|
|
18
|
+
"@astrojs/ts-plugin": "^1.10.2",
|
|
19
|
+
"typescript": "^5.8.2"{{#if frontend.eslint}},
|
|
20
|
+
"eslint": "^9",
|
|
21
|
+
"eslint-plugin-astro": "^1.3.1",
|
|
22
|
+
"eslint-config-prettier": "^10.1.8",
|
|
23
|
+
"globals": "^17.3.0",
|
|
24
|
+
"typescript-eslint": "^8.54.0"{{/if}}{{#if frontend.prettier}},
|
|
25
|
+
"prettier": "^3.8.1",
|
|
26
|
+
"prettier-plugin-astro": "^0.14.1"{{/if}}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
|
2
|
+
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
|
3
|
+
<style>
|
|
4
|
+
path { fill: #000; }
|
|
5
|
+
@media (prefers-color-scheme: dark) {
|
|
6
|
+
path { fill: #FFF; }
|
|
7
|
+
}
|
|
8
|
+
</style>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="115" height="48"><path fill="#17191E" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="url(#a)" d="M7.77 36.35C6.4 35.11 6 32.51 6.57 30.62c.99 1.2 2.35 1.57 3.75 1.78 2.18.33 4.31.2 6.33-.78.23-.12.44-.27.7-.42.18.55.23 1.1.17 1.67a4.56 4.56 0 0 1-1.94 3.23c-.43.32-.9.61-1.34.91-1.38.94-1.76 2.03-1.24 3.62l.05.17a3.63 3.63 0 0 1-1.6-1.38 3.87 3.87 0 0 1-.63-2.1c0-.37 0-.74-.05-1.1-.13-.9-.55-1.3-1.33-1.32a1.56 1.56 0 0 0-1.63 1.26c0 .06-.03.12-.05.2Z"/><path fill="#17191E" d="M.02 30.31s4.02-1.95 8.05-1.95l3.04-9.4c.11-.45.44-.76.82-.76.37 0 .7.31.82.76l3.04 9.4c4.77 0 8.05 1.95 8.05 1.95L17 11.71c-.2-.56-.53-.91-.98-.91H7.83c-.44 0-.76.35-.97.9L.02 30.31Zm42.37-5.97c0 1.64-2.05 2.62-4.88 2.62-1.85 0-2.5-.45-2.5-1.41 0-1 .8-1.49 2.65-1.49 1.67 0 3.09.03 4.73.23v.05Zm.03-2.04a21.37 21.37 0 0 0-4.37-.36c-5.32 0-7.82 1.25-7.82 4.18 0 3.04 1.71 4.2 5.68 4.2 3.35 0 5.63-.84 6.46-2.92h.14c-.03.5-.05 1-.05 1.4 0 1.07.18 1.16 1.06 1.16h4.15a16.9 16.9 0 0 1-.36-4c0-1.67.06-2.93.06-4.62 0-3.45-2.07-5.64-8.56-5.64-2.8 0-5.9.48-8.26 1.19.22.93.54 2.83.7 4.06 2.04-.96 4.95-1.37 7.2-1.37 3.11 0 3.97.71 3.97 2.15v.57Zm11.37 3c-.56.07-1.33.07-2.12.07-.83 0-1.6-.03-2.12-.1l-.02.58c0 2.85 1.87 4.52 8.45 4.52 6.2 0 8.2-1.64 8.2-4.55 0-2.74-1.33-4.09-7.2-4.39-4.58-.2-4.99-.7-4.99-1.28 0-.66.59-1 3.65-1 3.18 0 4.03.43 4.03 1.35v.2a46.13 46.13 0 0 1 4.24.03l.02-.55c0-3.36-2.8-4.46-8.2-4.46-6.08 0-8.13 1.49-8.13 4.39 0 2.6 1.64 4.23 7.48 4.48 4.3.14 4.77.62 4.77 1.28 0 .7-.7 1.03-3.71 1.03-3.47 0-4.35-.48-4.35-1.47v-.13Zm19.82-12.05a17.5 17.5 0 0 1-6.24 3.48c.03.84.03 2.4.03 3.24l1.5.02c-.02 1.63-.04 3.6-.04 4.9 0 3.04 1.6 5.32 6.58 5.32 2.1 0 3.5-.23 5.23-.6a43.77 43.77 0 0 1-.46-4.13c-1.03.34-2.34.53-3.78.53-2 0-2.82-.55-2.82-2.13 0-1.37 0-2.65.03-3.84 2.57.02 5.13.07 6.64.11-.02-1.18.03-2.9.1-4.04-2.2.04-4.65.07-6.68.07l.07-2.93h-.16Zm13.46 6.04a767.33 767.33 0 0 1 .07-3.18H82.6c.07 1.96.07 3.98.07 6.92 0 2.95-.03 4.99-.07 6.93h5.18c-.09-1.37-.11-3.68-.11-5.65 0-3.1 1.26-4 4.12-4 1.33 0 2.28.16 3.1.46.03-1.16.26-3.43.4-4.43-.86-.25-1.81-.41-2.96-.41-2.46-.03-4.26.98-5.1 3.38l-.17-.02Zm22.55 3.65c0 2.5-1.8 3.66-4.64 3.66-2.81 0-4.61-1.1-4.61-3.66s1.82-3.52 4.61-3.52c2.82 0 4.64 1.03 4.64 3.52Zm4.71-.11c0-4.96-3.87-7.18-9.35-7.18-5.5 0-9.23 2.22-9.23 7.18 0 4.94 3.49 7.59 9.21 7.59 5.77 0 9.37-2.65 9.37-7.6Z"/><defs><linearGradient id="a" x1="6.33" x2="19.43" y1="40.8" y2="34.6" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="1024" fill="none"><path fill="url(#a)" fill-rule="evenodd" d="M-217.58 475.75c91.82-72.02 225.52-29.38 341.2-44.74C240 415.56 372.33 315.14 466.77 384.9c102.9 76.02 44.74 246.76 90.31 366.31 29.83 78.24 90.48 136.14 129.48 210.23 57.92 109.99 169.67 208.23 155.9 331.77-13.52 121.26-103.42 264.33-224.23 281.37-141.96 20.03-232.72-220.96-374.06-196.99-151.7 25.73-172.68 330.24-325.85 315.72-128.6-12.2-110.9-230.73-128.15-358.76-12.16-90.14 65.87-176.25 44.1-264.57-26.42-107.2-167.12-163.46-176.72-273.45-10.15-116.29 33.01-248.75 124.87-320.79Z" clip-rule="evenodd" style="opacity:.154"/><path fill="url(#b)" fill-rule="evenodd" d="M1103.43 115.43c146.42-19.45 275.33-155.84 413.5-103.59 188.09 71.13 409 212.64 407.06 413.88-1.94 201.25-259.28 278.6-414.96 405.96-130 106.35-240.24 294.39-405.6 265.3-163.7-28.8-161.93-274.12-284.34-386.66-134.95-124.06-436-101.46-445.82-284.6-9.68-180.38 247.41-246.3 413.54-316.9 101.01-42.93 207.83 21.06 316.62 6.61Z" clip-rule="evenodd" style="opacity:.154"/><defs><linearGradient id="b" x1="373" x2="1995.44" y1="1100" y2="118.03" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient><linearGradient id="a" x1="107.37" x2="1130.66" y1="1993.35" y2="1026.31" gradientUnits="userSpaceOnUse"><stop stop-color="#3245FF"/><stop offset="1" stop-color="#BC52EE"/></linearGradient></defs></svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
|
+
<link rel="icon" href="/favicon.ico" />
|
|
8
|
+
<meta name="generator" content={Astro.generator} />
|
|
9
|
+
<title>Astro Basics</title>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<slot />
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
html,
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
# or
|
|
14
|
+
bun dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
20
|
+
|
|
21
|
+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
|
22
|
+
|
|
23
|
+
## Learn More
|
|
24
|
+
|
|
25
|
+
To learn more about Next.js, take a look at the following resources:
|
|
26
|
+
|
|
27
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
28
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
29
|
+
|
|
30
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
31
|
+
|
|
32
|
+
## Deploy on Vercel
|
|
33
|
+
|
|
34
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
35
|
+
|
|
36
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--background: #ffffff;
|
|
5
|
+
--foreground: #171717;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@theme inline {
|
|
9
|
+
--color-background: var(--background);
|
|
10
|
+
--color-foreground: var(--foreground);
|
|
11
|
+
--font-sans: var(--font-geist-sans);
|
|
12
|
+
--font-mono: var(--font-geist-mono);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
:root {
|
|
17
|
+
--background: #0a0a0a;
|
|
18
|
+
--foreground: #ededed;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
background: var(--background);
|
|
24
|
+
color: var(--foreground);
|
|
25
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
|
+
import "./globals.css";
|
|
4
|
+
|
|
5
|
+
const geistSans = Geist({
|
|
6
|
+
variable: "--font-geist-sans",
|
|
7
|
+
subsets: ["latin"],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const geistMono = Geist_Mono({
|
|
11
|
+
variable: "--font-geist-mono",
|
|
12
|
+
subsets: ["latin"],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const metadata: Metadata = {
|
|
16
|
+
title: "Create Next App",
|
|
17
|
+
description: "Generated by create next app",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default function RootLayout({
|
|
21
|
+
children,
|
|
22
|
+
}: Readonly<{
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}>) {
|
|
25
|
+
return (
|
|
26
|
+
<html lang="en">
|
|
27
|
+
<body
|
|
28
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function Home() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
|
4
|
+
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
|
5
|
+
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
|
6
|
+
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
|
7
|
+
Welcome to {{projectName}}
|
|
8
|
+
</h1>
|
|
9
|
+
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
|
10
|
+
This project was generated by Phos 🚀
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
</main>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
+
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
3
|
+
import nextTs from "eslint-config-next/typescript";
|
|
4
|
+
|
|
5
|
+
const eslintConfig = defineConfig([
|
|
6
|
+
...nextVitals,
|
|
7
|
+
...nextTs,
|
|
8
|
+
// Override default ignores of eslint-config-next.
|
|
9
|
+
globalIgnores([
|
|
10
|
+
// Default ignores of eslint-config-next:
|
|
11
|
+
".next/**",
|
|
12
|
+
"out/**",
|
|
13
|
+
"build/**",
|
|
14
|
+
"next-env.d.ts",
|
|
15
|
+
]),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export default eslintConfig;
|