# LinkedIn professional network LinkedIn is an independent, enterprise-deployable professional social network built as a local research replica of common professional-networking interaction patterns. It does not use LinkedIn branding, does not call LinkedIn APIs, and never requests LinkedIn credentials. ## Implemented scope - Public homepage with original LinkedIn branding and neutral professional imagery - Public Learning, Top Content, Games, and directory authwall routes from the observed public interaction matrix - Local email/password registration with email verification and PBKDF2 password hashing - HTTP-only database-backed sessions - Dynamic feed, post composer, likes, comments, optimistic UI states, and API persistence - Profile pages, experience data, profile editing API, relationship invitations, suggestions, and notifications - Messaging inbox with conversation persistence endpoints - Job search, detail view, API-confirmed saved jobs, application API, and recruiter job creation API with RBAC - Company pages and company/job APIs - Global search across people, jobs, companies, and posts - LinkedIn Premium subscription surface backed by Stripe Checkout, Billing Portal, and signed webhooks in Test Mode - Multi-tenant foundation through organizations, memberships, roles, tenant-scoped jobs, and audit logs - Loading, empty, and error states across the app shell - SQLite/D1 schema, migration SQL, deterministic demo seed data, tests, Docker, Nginx, Apache, systemd, health checks, and deployment preflight validation ## Stack - Next.js 16 App Router + TypeScript + React 19 - Drizzle ORM + Cloudflare D1/SQLite - Zod request validation - Node crypto PBKDF2 password hashing - Nodemailer transactional email adapter with a local development outbox - Stripe server SDK for test-mode subscription checkout and webhook reconciliation - Docker Compose with persistent SQLite, app, and Nginx reverse proxy ## Local development ```bash npm install export LINKEDIN_SQLITE_PATH=.data/linkedin.sqlite3 npm run db:migrate npm run dev ``` Open `http://localhost:3000`. The migration includes the deterministic `northstar-systems` tenant and demo Feed/Profile records. The TypeScript seeder remains available for idempotent reseeding: ```bash LINKEDIN_SQLITE_PATH=.data/linkedin.sqlite3 npm run db:seed ``` For a local WebsiteBench-style registration check on port 3103: ```bash LINKEDIN_SQLITE_PATH=.data/linkedin.sqlite3 \ DEFAULT_TENANT_SLUG=northstar-systems \ SESSION_SECRET=$(openssl rand -hex 32) \ SESSION_COOKIE_SECURE=false \ PUBLIC_CLONE_AUTH_MODE=local-dev \ PUBLIC_CLONE_AUTH_LOCAL_DEV_CODE=123456 \ PORT=3103 HOSTNAME=127.0.0.1 npm run start ``` Then open `http://127.0.0.1:3103/public-register` and use local verification code `123456`. Public deployment uses the authenticated `LINKEDIN_D1_PROXY_URL` bridge instead of a local database path. Seeded test account: ```text maya@example.com / LinkedInDemo123 ``` ## Validation ```bash npm run typecheck npm run lint npm run build npm test npm run test:flow npm run preflight -- --production ``` `npm run verify` runs the full validation sequence. To run the database-backed registration journey after SQLite is initialized: ```bash BASE_URL=http://localhost:3000 npm run test:e2e:registration ``` That E2E script registers a new account, consumes the local `.linkedin-mail` verification link when `EMAIL_DELIVERY_MODE=console`, creates a post, submits a job application, and checks the Premium guardrail. The main test suite also runs a real standalone production server against HTTP Redis/Resend and D1 mocks, then restarts it to verify session and post persistence. ## Docker deployment ```bash docker compose up --build ``` Compose runs the one-shot SQLite `migrate` service against a persistent volume, then starts the app and Nginx. To rerun the migration job manually: ```bash docker compose run --rm migrate ``` Open `http://localhost:8080` through Nginx. ## WebsiteBench public deployment WebsiteBench public deployment is packaged separately in `sources/w2w_workflow/examples/linkedin-public`. That flow uses `/public-register`, `/api/auth/send-code`, `/api/auth/verify-code`, and the vendored `websitebench.public_clone_auth` runtime. It does not use the local SMTP/nodemailer registration path or require Stripe checkout for core validation; Stripe remains workflow-pending for public deployment until WebsiteBench provides an approved adapter. ## Environment Required production values: ```bash LINKEDIN_D1_PROXY_URL=http://d1.internal/linkedin-db SESSION_SECRET=<32+ character random secret> EMAIL_VERIFICATION_SECRET=<32+ character random secret> SESSION_COOKIE_SECURE=true APP_URL=https://linkedin.example.com APP_ENV=production DEFAULT_TENANT_SLUG=northstar-systems EMAIL_DELIVERY_MODE=smtp MAIL_FROM="LinkedIn " SMTP_HOST= SMTP_PORT=587 SMTP_SECURE=false SMTP_USER= SMTP_PASS= STRIPE_SECRET_KEY= STRIPE_PREMIUM_PRICE_ID=price_... STRIPE_WEBHOOK_SECRET= ``` Before promoting a release, run a strict deployment preflight with production environment values loaded: ```bash npm run preflight -- --production ``` The preflight prints a sanitized JSON report. It checks the D1 proxy, session and email-verification secrets, HTTPS app URL, secure cookies, SMTP delivery, default tenant, and Stripe Test Mode configuration without printing secret values. ## Security boundary - This project creates only local LinkedIn accounts. - New local accounts must verify email before receiving a session. - The login page explicitly states that it is not a LinkedIn sign-in. - Billing code rejects non-test Stripe secret keys in this environment. - No route asks for LinkedIn credentials, tokens, cookies, or profile export files. - Mutating API routes reject cross-origin writes. - Tenant write operations check membership role before creating recruiter-owned resources. ## Production hardening checklist - Put D1 behind managed backup and restore drills. - Run migrations in CI/CD before promoting a release. - Add centralized logging and trace request IDs before accepting real user data. - Add password reset, MFA, and rate limiting before public launch. - Complete accessibility, privacy, and security review.