-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture Framework Integration
Version: 3.0.0
Status: ✅ Vollständig implementiert
VelinScript unterstützt automatische Framework-Erkennung und Code-Generierung für moderne HTTP-Frameworks in Rust, PHP und Python.
- Axum (Default): Moderne, async-first Architektur.
- Actix-Web: High-Performance Framework.
-
Laravel (Empfohlen): Generiert Controller-Klassen und
Route::getDefinitionen. -
Symfony: Generiert Controller mit
#[Route]Attributen.
- FastAPI (Empfohlen): Generiert Pydantic-Modelle und Async-Handler.
- Flask: Generiert Standard Flask-Routen und View-Functions.
- Express (Default): Generiert Router, Request-Handler und Interfaces.
-
NestJS: Generiert Controller (
@Controller), Module und DTOs.
-
Spring Boot: Generiert RestController (
@RestController), RequestMappings und Services.
-
ASP.NET Core: Generiert Controller (
Microsoft.AspNetCore.Mvc), Attributes ([HttpGet]) und Models.
- Gin (Empfohlen): High-Performance HTTP Web Framework. Generiert Struct-Tags für JSON und Gin-Handler.
Der Compiler erkennt das Framework auf drei Arten:
// velin.config.json
{
"target": "go",
"framework": "gin"
}@Gin
@GET("/api/users")
fn getUsers(): List<User> {
// ...
}
- Rust: Axum
- PHP: Laravel
- Python: FastAPI
- TypeScript: Express
- Java: Spring Boot
- C#: ASP.NET Core
- Go: Gin
Der Compiler generiert automatisch Framework-spezifische Imports für alle unterstützten Sprachen.
Laravel (PHP):
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Controller;FastAPI (Python):
from fastapi import FastAPI, HTTPException
from pydantic import BaseModelGin (Go):
import (
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)Express (TypeScript):
import express, { Request, Response } from 'express';Spring Boot (Java):
import org.springframework.web.bind.annotation.*;
import org.springframework.http.ResponseEntity;
import java.util.*;ASP.NET Core (C#):
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;Laravel: Generiert Routen am Ende der Datei, die auf Controller-Methoden verweisen:
Route::get('/api/users', [AppController::class, 'get_users']);Symfony: Nutzt Attribute direkt an den Methoden:
#[Route('/api/users', methods: ['GET'])]
public function get_users() { ... }FastAPI:
app.add_api_route("/api/users", get_users, methods=["GET"])Gin:
func main() {
r := gin.Default()
r.GET("/api/users", getUsersHandler)
r.Run()
}Express:
const app = express();
app.get("/api/users", getUsers);NestJS:
@Controller("/api/users")
export class UsersController {
@Get()
getUsers() { ... }
}Spring Boot:
@RestController
@RequestMapping("/api/users")
public class UsersController {
@GetMapping
public List<User> getUsers() { ... }
}ASP.NET Core:
[ApiController]
[Route("/api/users")]
public class UsersController : ControllerBase {
[HttpGet]
public ActionResult<List<User>> GetUsers() { ... }
}Der Compiler generiert Framework-spezifische Handler-Signaturen:
Axum:
async fn get_users_handler() -> impl IntoResponse {
// ...
}Actix-Web:
async fn get_users_handler(req: HttpRequest) -> impl Responder {
// ...
}Gin:
func getUsersHandler(c *gin.Context) {
// ...
}@GET("/api/users/:id")
fn getUser(id: string): User {
// ...
}
Axum:
async fn get_user_handler(Path(id): Path<String>) -> impl IntoResponse {
// ...
}Gin:
func getUserHandler(c *gin.Context) {
id := c.Param("id")
// ...
}@GET("/api/users")
fn getUsers(limit: number): List<User> {
// ...
}
Axum:
async fn get_users_handler(Query(params): Query<GetUsersParams>) -> impl IntoResponse {
// ...
}Gin:
func getUsersHandler(c *gin.Context) {
limitStr := c.Query("limit")
limit, _ := strconv.ParseFloat(limitStr, 64)
// ...
}@POST("/api/users")
fn createUser(user: UserInput): User {
// ...
}
Axum:
async fn create_user_handler(Json(user): Json<UserInput>) -> impl IntoResponse {
// ...
}Gin:
func createUserHandler(c *gin.Context) {
var user UserInput
if err := c.ShouldBindJSON(&user); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
// ...
}Der Compiler generiert automatisch einen globalen Error Handler:
struct AppError(anyhow::Error);
impl axum::response::IntoResponse for AppError {
fn into_response(self) -> axum::response::Response {
// Konvertiert Fehler in saubere JSON-Responses
// Status Code: 500 für interne Fehler
}
}@GET("/api/users/:id")
fn getUser(id: string): Result<User, string> {
// ...
}
Der Compiler konvertiert automatisch:
-
Ok(value)→ 200 OK mit JSON-Body -
Error(message)→ 400 Bad Request oder 500 Internal Server Error
@Auth
@GET("/api/profile")
fn getProfile(): User {
// ...
}
Der Compiler generiert automatisch Auth-Middleware-Integration für beide Frameworks.
@RateLimit(requests: 100, window: "1m")
@GET("/api/users")
fn getUsers(): List<User> {
// ...
}
Alle Handler werden automatisch mit #[tracing::instrument] versehen:
#[tracing::instrument]
async fn get_users_handler() -> impl IntoResponse {
// Automatisches Logging:
// - Request-ID
// - Latenz
// - Parameter
}Datei: compiler/src/codegen/framework.rs
Features:
-
FrameworkSelector::detect_framework()- Framework-Erkennung -
FrameworkSelector::generate_imports()- Import-Generierung -
FrameworkSelector::generate_app_init()- Router/App-Initialisierung -
FrameworkSelector::generate_handler_signature()- Handler-Signaturen
Letzte Aktualisierung: 2026-02-01
Version: 3.0.0
- Compiler Architecture
- Pass-Verlauf
- Type Inference
- Code Ordering
- IR Representation
- Borrow Checker
- Code Generation
- Multi-Target Compilation
- Module Resolution
- Framework Integration
- Parallelization
- AI Compiler Passes
- Prompt Optimizer
- System Generation
- Basics
- APIs
- Security
- Database
- Validation
- Authentication
- ML/LLM
- Intelligence Features
- Type Inference
- ML Training
- Pattern Matching
- Closures
- Collections
- HTTP Client
- String Interpolation
- Debugger
- Vektor-Datenbanken
- CLI Reference
- API Keys Setup
- Advanced
- Backend
- Security Best Practices
- AI/ML
- Auto Imports
- Plugin Development