Skip to main content

Hosting and Deployment

The platform is deployed on Vercel with a MongoDB Atlas database and external services for email and file storage.

Deployment Architecture

┌──────────────────────────────────────────────────────────┐
│ Vercel │
│ │
│ ┌─────────────────┐ ┌────────────────────────┐ │
│ │ Next.js App │ │ API Routes │ │
│ │ (SSR + Client) │ │ (Serverless Functions) │ │
│ └────────┬────────┘ └──────────┬─────────────┘ │
│ │ │ │
│ │ ┌───────────────────┤ │
│ │ │ Cron Job │ │
│ │ │ (Daily 08:00) │ │
│ │ └───────────────────┘ │
└────────────┼────────────────────────┼────────────────────┘
│ │
▼ ▼
┌────────────────────┐ ┌──────────────────────┐
│ MongoDB Atlas │ │ AWS Lambda (SES) │
│ (Database) │ │ (Email Service) │
└────────────────────┘ └──────────────────────┘

┌──────────────────────┤
▼ ▼
┌────────────────────┐ ┌──────────────────────┐
│ Cloudinary │ │ AWS CloudFront │
│ (File Storage) │ │ (CDN / S3) │
└────────────────────┘ └──────────────────────┘

Vercel Configuration

The deployment is configured via vercel.json:

{
"crons": [
{
"path": "/api/auto_reminder",
"schedule": "0 8 * * *"
}
]
}

This sets up a single cron job that hits the auto-reminder endpoint every day at 08:00 UTC to send email reminders for MOCs with upcoming or overdue deadlines.

Next.js Build Configuration

From next.config.ts:

const nextConfig: NextConfig = {
images: {
domains: [
"example.com",
"d1lzcclp79qvxc.cloudfront.net",
"ui-avatars.com",
],
},
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
};

Key settings:

  • Image domains — Allows Next.js Image Optimization for CloudFront CDN and UI Avatars service
  • Build error suppression — TypeScript and ESLint errors are ignored during the build process

Database Connection

The MongoDB connection is managed as a singleton in src/helpers/dbConnection.ts:

const connection = { isConnected: 0 };

async function dbConnect() {
if (connection.isConnected) return mongoose.connection;
const db = await mongoose.connect(process.env.REMOTE_URL!);
connection.isConnected = db.connections[0].readyState;
mongoose.set("strictPopulate", false);
return db;
}

The connection string is stored in the REMOTE_URL environment variable.

Email Service

Emails are sent via an AWS Lambda function that forwards to AWS SES. The Lambda endpoint URL is configured in src/helpers/send_email.ts.

const response = await fetch(
"https://{lambda-id}.lambda-url.eu-north-1.on.aws/",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
}
);

File Storage

The platform uses two file storage services:

  • Cloudinary — Primary storage for images and documents uploaded through the UI (profile pictures, signatures, attachments)
  • AWS S3 — Additional storage accessed via a custom endpoint configured in NEXT_PUBLIC_S3_BUCKET_URL

Real-time Features

Firebase is configured at src/lib/firebase.js for real-time notification capabilities.

Environment Variables

See Environment Configuration for a full list of required environment variables.