Habify BaseHabify Base
Careers & HiringHabify Base · Developer Experience Team2026-11-267 min read

Building a Company Career Portal & Secure Online CV Upload Flow on Habify Base

Launch a leak-proof company careers portal on Habify Base: filter open roles publicly, accept PDF/DOCX CVs through a bot-protected server handler into private storage, restrict reads to HR, and automate privacy erasure.

Smart Job SearchBot-Protected FormsPrivate CV VaultHR-Only Access
Secure career portal architecture: Turnstile BFF CV upload to private R2 with HR-only RLS

You can launch a production company careers portal with online CV submissions on Habify Base without ever exposing applicant resumes at guessable public URLs. Open job listings render straight from the browser Data API, while submitted PDF/DOCX files travel through a Turnstile-verified server endpoint into private storage.

Separating public job discovery from private CV ingestion lets candidates apply in 30 seconds with zero registration friction, while keeping every application accessible strictly to authenticated HR reviewers.

1. Leak-Proof Career Portal Architecture

Rushed job boards often drop candidate PDFs into public buckets or leave applicant tables writable from anonymous browsers. Habify Base compartments all six layers cleanly:

Hiring FlowHabify Base MechanismSecurity Guarantee
Job board filteringRead-only public RLS restricted to status = 'open'Filter cleanly by team, location, and search terms
Application + CV uploadServer Route Handler + Turnstile + secret keyEnforces human verification, file MIME, and 5MB cap first
CV object storagePrivate R2 or BYO S3 object storageZero public URLs; isolated under per-project prefix
HR applicant inboxjob_applications RLS with zero anon policyOnly signed-in HR team members can query candidates
Secure resume previewShort-lived 5-minute signed download URLsPrevents leaked CV links from staying accessible
Confirmation & erasureBranded BYO Email + Law 91/2025 subject erasureKeeps applicants informed and respects data retention rules

2. Public job_postings vs HR-Only job_applications Security

On job_applications, define policies solely for hr_recruiter and omit anon access entirely. Because Habify Base enforces Default-Deny Row-Level Security, any unauthenticated query fails inside PostgreSQL before touching applicant data:

sql
CREATE TABLE public.job_postings (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  title text NOT NULL,
  department text NOT NULL,
  location text NOT NULL,
  description_md text NOT NULL,
  status text NOT NULL DEFAULT 'open' CHECK (status IN ('draft', 'open', 'closed')),
  created_at timestamptz NOT NULL DEFAULT now()
);

ALTER TABLE public.job_postings ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.job_postings FORCE ROW LEVEL SECURITY;
CREATE POLICY jobs_public_open ON public.job_postings
  FOR SELECT USING (status = 'open');

CREATE TABLE public.job_applications (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  job_id uuid NOT NULL REFERENCES public.job_postings(id),
  full_name text NOT NULL,
  email text NOT NULL,
  phone text NOT NULL,
  cv_storage_path text NOT NULL,
  stage text NOT NULL DEFAULT 'new',
  created_at timestamptz NOT NULL DEFAULT now()
);

-- Khóa hoàn toàn truy cập bên ngoài; chỉ HR JWT mới được đọc và xử lý
ALTER TABLE public.job_applications ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.job_applications FORCE ROW LEVEL SECURITY;
CREATE POLICY applications_hr_only ON public.job_applications
  USING (current_setting('app.current_role', true) = 'hr_recruiter')
  WITH CHECK (current_setting('app.current_role', true) = 'hr_recruiter');

3. Handling CV Uploads Safely via Server Verification and Private Storage

Your career form posts multipart data to a server Route Handler where Turnstile tokens, PDF/DOCX MIME types, and file size limits are checked before storing the resume privately and recording the candidate row.

Inside the HR review view, your backend verifies the recruiter session and mints a 5-minute signed URL:

ts
// Next.js Route Handler: POST /api/careers/apply (chạy phía server)
import { NextResponse } from "next/server";
import { habifyServer } from "@/lib/habify-server";

export async function POST(req: Request) {
  const form = await req.formData();
  const cvFile = form.get("cv") as File | null;
  const turnstileToken = String(form.get("turnstile_token") ?? "");

  await verifyTurnstileOrThrow(turnstileToken);
  if (!cvFile || cvFile.size > 5 * 1024 * 1024 || cvFile.type !== "application/pdf") {
    return NextResponse.json({ error: "CV PDF <= 5MB required" }, { status: 400 });
  }

  const jobId = String(form.get("job_id"));
  const safePath = `cv/${jobId}/${crypto.randomUUID()}.pdf`;

  await habifyServer.storage.upload({
    path: safePath,
    file: cvFile,
    visibility: "private",
  });

  await habifyServer.db.from("job_applications").insert({
    job_id: jobId,
    full_name: String(form.get("full_name")),
    email: String(form.get("email")),
    phone: String(form.get("phone")),
    cv_storage_path: safePath,
  });

  return NextResponse.json({ ok: true }, { status: 201 });
}

// Khi HR bấm xem CV ứng viên:
const { url } = await habifyServer.storage.createSignedUrl(cvStoragePath, {
  expires_at: new Date(Date.now() + 5 * 60 * 1000).toISOString(),
});

4. Branded Candidate Emails & Law 91/2025 Data Erasure

Once saved, send a clean confirmation receipt through your verified BYO email domain using Habify's standardized responsive layout so recruitment updates land in the primary inbox.

Whenever a candidate requests deletion or reaches retention expiry under Law 91/2025/QH15, call habifyServer.storage.delete() and habifyServer.eraseDataSubject() to wipe artifacts cleanly.

Frequently Asked Questions

Why verify CV uploads through a server endpoint instead of direct browser upload?

A server Route Handler enforces Turnstile checks, MIME validation, and 5MB file caps before storing files, preventing storage-flooding bots from filling your quota.

Will storing thousands of PDF resumes get expensive over time?

From Starter tier upward, attach your own Cloudflare R2 or AWS S3 bucket via BYO Storage with zero managed storage or egress markup.

How do HR managers sign in to inspect candidate CVs?

Use Shared Habify Account SSO mapped to role hr_recruiter or isolated project-local HR accounts inside habify_sys.

Related Documentation & Guides

Launch This Architecture in Free Sandbox in 3 Minutes

Spin up an isolated PostgreSQL 18 database, grab your hb_pk_* / hb_sk_* keys, and wire @habifybase/sdk.

More Engineering Articles & Use Cases