feat: add bot and api services with config, logger and database packages

- Add bot service with telegram integration and webhook/polling modes
- Add api service with hono, swagger and zod-openapi
- Create config package for environment variable management
- Create logger package for colored console logging
- Create database package with prisma integration
- Remove next.js web and docs apps
- Update turbo.json for new services
- Add dockerfiles and gitea workflows for deployment
This commit is contained in:
Yuu Ottosoka
2025-07-08 19:46:08 +03:00
parent 393c175460
commit 71365836d3
85 changed files with 5635 additions and 4333 deletions

10
apps/api/src/config.ts Normal file
View File

@@ -0,0 +1,10 @@
import { createConfig } from '@repo/config';
import z from 'zod';
import 'dotenv/config';
export const config = createConfig({
schema: {
PORT: z.string().default('3001'),
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
},
});

35
apps/api/src/index.ts Normal file
View File

@@ -0,0 +1,35 @@
import { serve } from '@hono/node-server';
import { OpenAPIHono } from '@hono/zod-openapi';
import { swaggerUI } from '@hono/swagger-ui';
import { config } from './config';
import { logger } from '@repo/logger';
const app = new OpenAPIHono();
// OpenAPI documentation
app.doc('/doc', {
openapi: '3.0.0',
info: {
version: '1.0.0',
title: 'API Documentation',
description: 'API built with Hono and Zod OpenAPI',
},
});
// Swagger UI
app.get('/ui', swaggerUI({ url: '/doc' }));
// Health check
app.get('/health', (c) => {
return c.json({ status: 'ok', timestamp: new Date().toISOString() });
});
const port = parseInt(config.PORT);
logger.info(`Starting API server on port ${port}`);
logger.info(`Swagger UI available at http://localhost:${port}/ui`);
serve({
fetch: app.fetch,
port,
});