chore: add mock API route handlers and dev env config

This commit is contained in:
Ilia Mashkov
2026-05-05 09:41:39 +03:00
parent 41edc7edf7
commit 4b18fc454e
10 changed files with 659 additions and 0 deletions
@@ -0,0 +1,263 @@
import { NextResponse } from 'next/server';
export const dynamic = 'force-dynamic';
const base = { created: '', updated: '' };
const FIXTURES: Record<string, unknown[]> = {
sections: [
{
id: '1',
collectionId: 'sections',
collectionName: 'sections',
...base,
slug: 'intro',
title: 'Introduction',
number: '01',
order: 1,
},
{
id: '2',
collectionId: 'sections',
collectionName: 'sections',
...base,
slug: 'bio',
title: 'Biography',
number: '02',
order: 2,
},
{
id: '3',
collectionId: 'sections',
collectionName: 'sections',
...base,
slug: 'skills',
title: 'Skills',
number: '03',
order: 3,
},
{
id: '4',
collectionId: 'sections',
collectionName: 'sections',
...base,
slug: 'experience',
title: 'Experience',
number: '04',
order: 4,
},
{
id: '5',
collectionId: 'sections',
collectionName: 'sections',
...base,
slug: 'projects',
title: 'Projects',
number: '05',
order: 5,
},
],
intro: [
{
id: '1',
collectionId: 'intro',
collectionName: 'intro',
...base,
slug: 'intro',
content:
"I'm a software engineer and designer building thoughtful digital products. I combine technical depth with a strong eye for design to create experiences that are both functional and beautiful.",
},
],
bio: [
{
id: '1',
collectionId: 'bio',
collectionName: 'bio',
...base,
slug: 'bio',
content:
"Based in Berlin. I've spent the last 8 years working at the intersection of product, design, and engineering. I believe the best products come from teams where these disciplines overlap and inform each other. When I'm not building, I'm reading, cooking, or somewhere with bad WiFi.",
},
],
skills: [
{
id: 's1',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'TypeScript',
category: 'Frontend',
order: 1,
},
{
id: 's2',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'React',
category: 'Frontend',
order: 2,
},
{
id: 's3',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'Next.js',
category: 'Frontend',
order: 3,
},
{
id: 's4',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'Tailwind CSS',
category: 'Frontend',
order: 4,
},
{
id: 's5',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'Node.js',
category: 'Backend',
order: 1,
},
{ id: 's6', collectionId: 'skills', collectionName: 'skills', ...base, name: 'Go', category: 'Backend', order: 2 },
{
id: 's7',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'PostgreSQL',
category: 'Backend',
order: 3,
},
{
id: 's8',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'Figma',
category: 'Design',
order: 1,
},
{
id: 's9',
collectionId: 'skills',
collectionName: 'skills',
...base,
name: 'Docker',
category: 'Tools',
order: 1,
},
{ id: 's10', collectionId: 'skills', collectionName: 'skills', ...base, name: 'Git', category: 'Tools', order: 2 },
],
experience: [
{
id: 'e1',
collectionId: 'experience',
collectionName: 'experience',
...base,
company: 'Figma',
role: 'Senior Software Engineer',
start_date: '2022-03-01T00:00:00Z',
end_date: null,
description:
'Building the multiplayer infrastructure for real-time collaborative design tools. Led the migration from polling to WebSocket-based sync, reducing latency by 60%.',
order: 1,
},
{
id: 'e2',
collectionId: 'experience',
collectionName: 'experience',
...base,
company: 'N26',
role: 'Frontend Engineer',
start_date: '2019-06-01T00:00:00Z',
end_date: '2022-02-28T00:00:00Z',
description:
'Built and maintained the mobile banking web app serving 8 million customers. Owned the transaction history feature and drove accessibility improvements to WCAG 2.1 AA.',
order: 2,
},
{
id: 'e3',
collectionId: 'experience',
collectionName: 'experience',
...base,
company: 'Freelance',
role: 'Full-Stack Developer',
start_date: '2017-01-01T00:00:00Z',
end_date: '2019-05-31T00:00:00Z',
description: 'Worked with early-stage startups across fintech and healthtech to design and ship product MVPs.',
order: 3,
},
],
projects: [
{
id: 'p1',
collectionId: 'projects',
collectionName: 'projects',
...base,
title: 'Monograph',
year: '2024',
role: 'Lead Engineer & Designer',
description: 'A personal publishing platform built for long-form writing and visual essays.',
details: ['Custom rich-text editor', 'SSG with 100/100 Lighthouse', 'Sub-second TTFB globally'],
stack: ['Next.js', 'TypeScript', 'Tailwind CSS', 'PocketBase'],
image: '',
order: 1,
},
{
id: 'p2',
collectionId: 'projects',
collectionName: 'projects',
...base,
title: 'Verdant',
year: '2023',
role: 'Full-Stack Developer',
description: 'An inventory and sales management tool for independent plant nurseries.',
details: ['QR-code scanning', 'Offline-first PWA', 'Multi-location sync'],
stack: ['React', 'Go', 'PostgreSQL', 'Docker'],
image: '',
order: 2,
},
{
id: 'p3',
collectionId: 'projects',
collectionName: 'projects',
...base,
title: 'Folio',
year: '2022',
role: 'Designer & Developer',
description: 'A minimal portfolio generator for creative professionals.',
details: ['No-code page builder', 'Custom domain support'],
stack: ['Next.js', 'Prisma', 'Figma'],
image: '',
order: 3,
},
],
};
/**
* Mock API route handler for PocketBase collection records.
* Returns fixture data shaped as a PocketBase list response.
*/
export async function GET(_req: Request, { params }: { params: Promise<{ collection: string }> }) {
const { collection } = await params;
const items = FIXTURES[collection];
if (!items) {
return NextResponse.json({ message: 'Not found' }, { status: 404 });
}
return NextResponse.json({
page: 1,
perPage: items.length,
totalItems: items.length,
totalPages: 1,
items,
});
}