🌊 TeamFlow — Modern Trello alternative with email integration

- Full-stack: React 18 + Express + SQLite
- Drag-and-drop kanban boards with @hello-pangea/dnd
- Google App Password email integration (SMTP + IMAP)
- Inbound email: create cards by sending emails
- Reply-to-card: email replies become comments
- Admin/user management with role-based access
- Setup wizard: email config → admin creation
- Checklists, time tracking, priorities, labels, due dates
- Real-time notifications with activity feed
- Beautiful HTML email templates
This commit is contained in:
admin
2026-04-03 15:11:27 +00:00
Unverified
commit 460f83aef8
40 changed files with 8512 additions and 0 deletions

66
server/index.js Normal file
View File

@@ -0,0 +1,66 @@
import express from 'express';
import cors from 'cors';
import { readFileSync } from 'fs';
import { createServer as createHttpsServer } from 'https';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import db from './db.js';
import { initTransporter } from './email/transporter.js';
import { startImapPolling } from './email/imap.js';
import setupRoutes from './routes/setup.js';
import authRoutes from './routes/auth.js';
import userRoutes from './routes/users.js';
import boardRoutes from './routes/boards.js';
import cardRoutes from './routes/cards.js';
import notificationRoutes from './routes/notifications.js';
import emailRoutes from './routes/email.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const app = express();
const PORT = process.env.PORT || 3001;
app.use(cors());
app.use(express.json({ limit: '10mb' }));
app.use('/api/setup', setupRoutes);
app.use('/api/auth', authRoutes);
app.use('/api/users', userRoutes);
app.use('/api/boards', boardRoutes);
app.use('/api/cards', cardRoutes);
app.use('/api/notifications', notificationRoutes);
app.use('/api/email', emailRoutes);
app.use('/api', (req, res) => res.status(404).json({ error: 'Not found' }));
const clientDist = join(__dirname, '..', 'client', 'dist');
app.use(express.static(clientDist));
app.get('*', (req, res) => {
if (req.path.startsWith('/api')) return res.status(404).json({ error: 'Not found' });
res.sendFile(join(clientDist, 'index.html'));
});
const SSL_KEY = process.env.SSL_KEY || '';
const SSL_CERT = process.env.SSL_CERT || '';
async function startServer() {
const hasEmail = !!db.prepare('SELECT 1 FROM email_config WHERE id = 1').get();
if (hasEmail) {
const ok = await initTransporter();
if (ok) console.log('✉️ Email configured and verified');
startImapPolling();
}
if (SSL_KEY && SSL_CERT) {
const server = createHttpsServer({
key: readFileSync(SSL_KEY),
cert: readFileSync(SSL_CERT),
}, app);
server.listen(PORT, () => console.log(`🚀 TeamFlow server running on https://localhost:${PORT}`));
} else {
app.listen(PORT, () => console.log(`🚀 TeamFlow server running on http://localhost:${PORT}`));
}
}
startServer();