kybernus 1.1.0 → 1.1.4
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/README.md +3 -4
- package/dist/cli/commands/init.js +11 -11
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/register.js +1 -1
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/upgrade.js +3 -3
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/prompts/wizard.js +22 -22
- package/dist/cli/prompts/wizard.js.map +1 -1
- package/dist/cli/services/AnalyticsClient.js +1 -1
- package/dist/cli/services/AnalyticsClient.js.map +1 -1
- package/dist/core/auth/license-validator.js +1 -1
- package/dist/core/auth/license-validator.js.map +1 -1
- package/dist/core/generator/project.d.ts +9 -9
- package/dist/core/generator/project.js +61 -61
- package/dist/core/generator/project.js.map +1 -1
- package/dist/core/templates/downloader.js +1 -1
- package/dist/core/templates/downloader.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/LICENSE +0 -20
- package/templates/nestjs/free/mvc/README.md.hbs +0 -28
- package/templates/nestjs/free/mvc/package.json.hbs +0 -29
- package/templates/nestjs/free/mvc/src/app.module.ts.hbs +0 -13
- package/templates/nestjs/free/mvc/src/controllers/health.controller.ts.hbs +0 -9
- package/templates/nestjs/free/mvc/src/controllers/items.controller.ts.hbs +0 -32
- package/templates/nestjs/free/mvc/src/main.ts.hbs +0 -17
- package/templates/nestjs/free/mvc/src/models/create-item.dto.ts.hbs +0 -10
- package/templates/nestjs/free/mvc/src/models/item.model.ts.hbs +0 -6
- package/templates/nestjs/free/mvc/src/modules/items.module.ts.hbs +0 -9
- package/templates/nestjs/free/mvc/src/services/items.service.ts.hbs +0 -32
- package/templates/nestjs/free/mvc/tsconfig.json.hbs +0 -21
- package/templates/python-fastapi/free/mvc/README.md.hbs +0 -41
- package/templates/python-fastapi/free/mvc/app/controllers/health.py.hbs +0 -7
- package/templates/python-fastapi/free/mvc/app/controllers/items.py.hbs +0 -27
- package/templates/python-fastapi/free/mvc/app/main.py.hbs +0 -26
- package/templates/python-fastapi/free/mvc/app/models/item.py.hbs +0 -11
- package/templates/python-fastapi/free/mvc/app/schemas/item.py.hbs +0 -17
- package/templates/python-fastapi/free/mvc/app/services/item_service.py.hbs +0 -33
- package/templates/python-fastapi/free/mvc/requirements.txt.hbs +0 -4
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"removeComments": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"target": "ES2021",
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"incremental": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"strictNullChecks": true,
|
|
16
|
-
"noImplicitAny": true,
|
|
17
|
-
"strictBindCallApply": true,
|
|
18
|
-
"forceConsistentCasingInFileNames": true,
|
|
19
|
-
"noFallthroughCasesInSwitch": true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
> Generated by [Kybernus CLI](https://kybernus.dev) 🚀 (Free)
|
|
4
|
-
|
|
5
|
-
## Stack
|
|
6
|
-
|
|
7
|
-
- **Framework**: FastAPI
|
|
8
|
-
- **Python**: 3.11+
|
|
9
|
-
- **Validation**: Pydantic v2
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# Create virtual environment
|
|
15
|
-
python -m venv venv
|
|
16
|
-
source venv/bin/activate # Linux/Mac
|
|
17
|
-
# or: venv\Scripts\activate # Windows
|
|
18
|
-
|
|
19
|
-
# Install dependencies
|
|
20
|
-
pip install -r requirements.txt
|
|
21
|
-
|
|
22
|
-
# Run development server
|
|
23
|
-
uvicorn app.main:app --reload
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## API Endpoints
|
|
27
|
-
|
|
28
|
-
- `GET /api/health` - Health check
|
|
29
|
-
- `GET /api/items` - List items
|
|
30
|
-
- `POST /api/items` - Create item
|
|
31
|
-
- `GET /api/items/{id}` - Get item
|
|
32
|
-
- `DELETE /api/items/{id}` - Delete item
|
|
33
|
-
|
|
34
|
-
## Documentation
|
|
35
|
-
|
|
36
|
-
- Swagger UI: http://localhost:8000/docs
|
|
37
|
-
- ReDoc: http://localhost:8000/redoc
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
Made with ❤️ using [Kybernus](https://kybernus.dev)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from fastapi import APIRouter, HTTPException
|
|
2
|
-
from typing import List
|
|
3
|
-
from app.schemas.item import ItemCreate, ItemResponse
|
|
4
|
-
from app.services.item_service import ItemService
|
|
5
|
-
|
|
6
|
-
router = APIRouter()
|
|
7
|
-
item_service = ItemService()
|
|
8
|
-
|
|
9
|
-
@router.get("/", response_model=List[ItemResponse])
|
|
10
|
-
async def get_items():
|
|
11
|
-
return item_service.get_all()
|
|
12
|
-
|
|
13
|
-
@router.get("/{item_id}", response_model=ItemResponse)
|
|
14
|
-
async def get_item(item_id: str):
|
|
15
|
-
item = item_service.get_by_id(item_id)
|
|
16
|
-
if not item:
|
|
17
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
18
|
-
return item
|
|
19
|
-
|
|
20
|
-
@router.post("/", response_model=ItemResponse, status_code=201)
|
|
21
|
-
async def create_item(item: ItemCreate):
|
|
22
|
-
return item_service.create(item)
|
|
23
|
-
|
|
24
|
-
@router.delete("/{item_id}", status_code=204)
|
|
25
|
-
async def delete_item(item_id: str):
|
|
26
|
-
if not item_service.delete(item_id):
|
|
27
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from fastapi import FastAPI
|
|
2
|
-
from fastapi.middleware.cors import CORSMiddleware
|
|
3
|
-
from app.controllers import health, items
|
|
4
|
-
|
|
5
|
-
app = FastAPI(
|
|
6
|
-
title="{{projectNamePascalCase}}",
|
|
7
|
-
description="Generated by Kybernus CLI",
|
|
8
|
-
version="1.0.0"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
# CORS
|
|
12
|
-
app.add_middleware(
|
|
13
|
-
CORSMiddleware,
|
|
14
|
-
allow_origins=["*"],
|
|
15
|
-
allow_credentials=True,
|
|
16
|
-
allow_methods=["*"],
|
|
17
|
-
allow_headers=["*"],
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Routes
|
|
21
|
-
app.include_router(health.router, prefix="/api", tags=["Health"])
|
|
22
|
-
app.include_router(items.router, prefix="/api/items", tags=["Items"])
|
|
23
|
-
|
|
24
|
-
@app.get("/")
|
|
25
|
-
async def root():
|
|
26
|
-
return {"message": "Welcome to {{projectNamePascalCase}} API"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import uuid
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class Item:
|
|
8
|
-
id: str = field(default_factory=lambda: str(uuid.uuid4()))
|
|
9
|
-
name: str = ""
|
|
10
|
-
description: Optional[str] = None
|
|
11
|
-
created_at: datetime = field(default_factory=datetime.now)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
class ItemBase(BaseModel):
|
|
6
|
-
name: str
|
|
7
|
-
description: Optional[str] = None
|
|
8
|
-
|
|
9
|
-
class ItemCreate(ItemBase):
|
|
10
|
-
pass
|
|
11
|
-
|
|
12
|
-
class ItemResponse(ItemBase):
|
|
13
|
-
id: str
|
|
14
|
-
created_at: datetime
|
|
15
|
-
|
|
16
|
-
class Config:
|
|
17
|
-
from_attributes = True
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
from app.models.item import Item
|
|
3
|
-
from app.schemas.item import ItemCreate
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
import uuid
|
|
6
|
-
|
|
7
|
-
class ItemService:
|
|
8
|
-
"""Item Service - Business Logic Layer"""
|
|
9
|
-
|
|
10
|
-
def __init__(self):
|
|
11
|
-
self._items: dict[str, Item] = {}
|
|
12
|
-
|
|
13
|
-
def get_all(self) -> List[Item]:
|
|
14
|
-
return list(self._items.values())
|
|
15
|
-
|
|
16
|
-
def get_by_id(self, item_id: str) -> Optional[Item]:
|
|
17
|
-
return self._items.get(item_id)
|
|
18
|
-
|
|
19
|
-
def create(self, data: ItemCreate) -> Item:
|
|
20
|
-
item = Item(
|
|
21
|
-
id=str(uuid.uuid4()),
|
|
22
|
-
name=data.name,
|
|
23
|
-
description=data.description,
|
|
24
|
-
created_at=datetime.now()
|
|
25
|
-
)
|
|
26
|
-
self._items[item.id] = item
|
|
27
|
-
return item
|
|
28
|
-
|
|
29
|
-
def delete(self, item_id: str) -> bool:
|
|
30
|
-
if item_id in self._items:
|
|
31
|
-
del self._items[item_id]
|
|
32
|
-
return True
|
|
33
|
-
return False
|