feat: Architektur & Tech-Stack Dokumentation

📐 Architektur:
- Cloud-basiert (SaaS) Entscheidung
- Multi-Tenancy Konzept
- Architektur-Diagramm

🛠️ Tech-Stack:
- Deno + Oak Backend
- PostgreSQL Datenbank
- Vue 3 + PrimeVue Frontend
- Hetzner Hosting (DSGVO)

📁 Projektstruktur:
- src/ mit routes, middleware, services
- docs/ mit Architektur-Doku
- Basis main.ts mit Health Check
This commit is contained in:
2026-02-11 09:59:54 +00:00
parent 3761985893
commit d9e4539dd6
7 changed files with 447 additions and 2 deletions

81
src/main.ts Normal file
View File

@@ -0,0 +1,81 @@
import { Application } from "@oak/oak";
import "@std/dotenv/load";
const app = new Application();
const PORT = parseInt(Deno.env.get("PORT") || "8000");
// CORS Middleware
app.use(async (ctx, next) => {
ctx.response.headers.set("Access-Control-Allow-Origin", "*");
ctx.response.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
ctx.response.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization");
if (ctx.request.method === "OPTIONS") {
ctx.response.status = 204;
return;
}
await next();
});
// Logger Middleware
app.use(async (ctx, next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
console.log(`${ctx.request.method} ${ctx.request.url.pathname} - ${ctx.response.status} (${ms}ms)`);
});
// Health Check
app.use(async (ctx, next) => {
if (ctx.request.url.pathname === "/health") {
ctx.response.body = {
status: "ok",
service: "pulse-crm-backend",
version: "0.1.0",
timestamp: new Date().toISOString()
};
return;
}
await next();
});
// API Info
app.use(async (ctx, next) => {
if (ctx.request.url.pathname === "/api" || ctx.request.url.pathname === "/api/v1") {
ctx.response.body = {
name: "Pulse CRM API",
version: "1.0.0",
docs: "/api/v1/docs",
endpoints: {
auth: "/api/v1/auth/*",
contacts: "/api/v1/contacts/*",
companies: "/api/v1/companies/*",
deals: "/api/v1/deals/*",
pipelines: "/api/v1/pipelines/*",
activities: "/api/v1/activities/*",
users: "/api/v1/users/*"
}
};
return;
}
await next();
});
// 404 Handler
app.use((ctx) => {
ctx.response.status = 404;
ctx.response.body = {
success: false,
error: {
code: "NOT_FOUND",
message: "Endpoint not found"
}
};
});
console.log(`🚀 Pulse CRM Backend starting on port ${PORT}...`);
console.log(`📚 API Docs: http://localhost:${PORT}/api/v1`);
console.log(`❤️ Health: http://localhost:${PORT}/health`);
await app.listen({ port: PORT });