Add lock files for package management and update architecture documentation

- Introduced bun.lock and package-lock.json to manage dependencies for the project.
- Enhanced backend API architecture documentation with additional security and documentation guidelines.
- Made minor formatting adjustments across various files for consistency and clarity.
This commit is contained in:
2025-12-11 02:11:43 -05:00
parent 4911b5d125
commit 40210c454e
74 changed files with 2599 additions and 1386 deletions

View File

@@ -20,24 +20,28 @@ import {dashboardRoutes} from './routes/dashboard.routes';
* Implements Single Responsibility: Server configuration
*/
export async function buildServer() {
if (env.NODE_ENV !== 'production') {
console.log('Development mode enabled. Environment variables [%o]', env);
}
const fastify = Fastify({
logger: {
level: env.NODE_ENV === 'development' ? 'info' : 'error',
transport: env.NODE_ENV === 'development' ? {target: 'pino-pretty'} : undefined,
},
transport: env.NODE_ENV === 'development' ? {target: 'pino-pretty'} : undefined
}
});
// Register plugins
await fastify.register(cors, {
origin: env.CORS_ORIGIN,
credentials: true,
credentials: true
});
await fastify.register(jwt, {
secret: env.JWT_SECRET,
sign: {
expiresIn: env.JWT_EXPIRES_IN,
},
expiresIn: env.JWT_EXPIRES_IN
}
});
// Register Swagger for API documentation
@@ -46,32 +50,32 @@ export async function buildServer() {
info: {
title: 'Personal Finances API',
description: 'API for managing personal finances including assets, liabilities, invoices, and more',
version: '1.0.0',
version: '1.0.0'
},
servers: [
{
url: `http://localhost:${env.PORT}`,
description: 'Development server',
},
description: 'Development server'
}
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
},
},
},
bearerFormat: 'JWT'
}
}
}
}
});
await fastify.register(swaggerUi, {
routePrefix: '/docs',
uiConfig: {
docExpansion: 'list',
deepLinking: false,
},
deepLinking: false
}
});
// Register error handler
@@ -80,7 +84,7 @@ export async function buildServer() {
// Health check
fastify.get('/health', async () => ({
status: 'ok',
timestamp: new Date().toISOString(),
timestamp: new Date().toISOString()
}));
// Register routes