- SEC filings extraction (10-K, 10-Q, 8-K) - Portfolio analytics with real-time prices - Watchlist management - NextAuth.js authentication - OpenClaw AI integration - PostgreSQL database with auto P&L calculations - Elysia.js backend (Bun runtime) - Next.js 14 frontend (TailwindCSS + Recharts) - Production-ready Docker configurations
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { Elysia } from 'elysia';
|
|
import { cors } from '@elysiajs/cors';
|
|
import { swagger } from '@elysiajs/swagger';
|
|
import * as dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
import { db } from './db';
|
|
import { filingsRoutes } from './routes/filings';
|
|
import { portfolioRoutes } from './routes/portfolio';
|
|
import { openclawRoutes } from './routes/openclaw';
|
|
import { authRoutes } from './routes/auth';
|
|
import { watchlistRoutes } from './routes/watchlist';
|
|
|
|
const app = new Elysia({
|
|
prefix: '/api'
|
|
})
|
|
.use(cors({
|
|
origin: '*',
|
|
credentials: true,
|
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
|
|
}))
|
|
.use(swagger({
|
|
documentation: {
|
|
info: {
|
|
title: 'Fiscal Clone API',
|
|
version: '1.0.0',
|
|
description: 'Financial filings and portfolio analytics API'
|
|
}
|
|
}
|
|
}))
|
|
.use(authRoutes)
|
|
.use(filingsRoutes)
|
|
.use(portfolioRoutes)
|
|
.use(watchlistRoutes)
|
|
.use(openclawRoutes)
|
|
|
|
// Health check
|
|
.get('/health', () => ({
|
|
status: 'ok',
|
|
timestamp: new Date().toISOString(),
|
|
version: '1.0.0',
|
|
database: 'connected'
|
|
}))
|
|
|
|
.listen(process.env.PORT || 3001);
|
|
|
|
console.log(`🚀 Backend running on http://localhost:${app.server?.port}`);
|
|
console.log(`📚 Swagger docs: http://localhost:${app.server?.port}/swagger`);
|