Initial commit: AutoJobs MVP - AI job application platform

This commit is contained in:
2026-04-13 18:39:26 +02:00
commit 8d1845c874
16 changed files with 3483 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { NextRequest, NextResponse } from "next/server"
import { cookies } from "next/headers"
export async function POST(req: NextRequest) {
const { email } = await req.json()
const cookieStore = await cookies()
cookieStore.set("autojobs_user", email.split("@")[0], {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
sameSite: "lax",
maxAge: 60 * 60 * 24 * 30
})
return NextResponse.json({ status: "ok" })
}
+36
View File
@@ -0,0 +1,36 @@
import { NextRequest, NextResponse } from "next/server"
import { cookies } from "next/headers"
export async function POST(req: NextRequest) {
const { email, password, name } = await req.json()
if (!email || !password) {
return NextResponse.json({ error: "Email and password required" }, { status: 400 })
}
// In production: hash password, store in DB
// For MVP: create user in backend DB, set cookie
try {
const res = await fetch(`${process.env.API_URL || "http://localhost:8000"}/users`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ user_id: email.split("@")[0], email, name })
})
if (!res.ok) {
return NextResponse.json({ error: "Failed to create user" }, { status: 500 })
}
const cookieStore = await cookies()
cookieStore.set("autojobs_user", email.split("@")[0], {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
sameSite: "lax",
maxAge: 60 * 60 * 24 * 30 // 30 days
})
return NextResponse.json({ status: "ok" })
} catch {
return NextResponse.json({ error: "Server error" }, { status: 500 })
}
}