Next.js App Router site for the MakerSpace storefront and member dashboard. The public site handles the marketing and commerce pages, while the protected dashboard uses Clerk for auth and SpacetimeDB for realtime member data.
- Public site pages for the storefront, education, repairs, and contact flows.
- Protected dashboard routes for
Overview,How-To,Community, andAdmin. - Clerk-based auth with App Router catch-all routes for sign-in, sign-up, and redirect callbacks.
- A SpacetimeDB module that stores member profiles, groups, channels, DMs, messages, and tutorials.
- Generated TypeScript bindings in
src/module_bindingsfor the frontend client.
- Node.js 20+
- npm
- SpacetimeDB CLI installed and authenticated if you want to publish or regenerate bindings
- A Clerk application with a JWT template named
spacetimedb
- Copy
.env.exampleto.env.local. - Fill in your Clerk keys.
- Set the SpacetimeDB connection values for your target environment.
- Set
MAKERSPACE_OWNER_CLERK_IDto the Clerk user that should unlock the admin dashboard.
Example:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_REPLACE_ME
CLERK_SECRET_KEY=sk_test_REPLACE_ME
CLERK_JWT_TEMPLATE_NAME=spacetimedb
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/login
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/register
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/dashboard/how-to
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/dashboard/how-to
NEXT_PUBLIC_SPACETIMEDB_URI=ws://127.0.0.1:3000
NEXT_PUBLIC_SPACETIMEDB_MODULE=makerspace
MAKERSPACE_OWNER_CLERK_ID=user_REPLACE_METhe module source reads the owner Clerk id from spacetimedb/src/admin.ts. That file is intentionally gitignored so a real user id does not get committed.
- Copy
spacetimedb/src/admin.ts.exampletospacetimedb/src/admin.ts. - Replace the placeholder with the same Clerk user id you used for
MAKERSPACE_OWNER_CLERK_ID.
export const ADMIN_CLERK_ID = "user_REPLACE_ME"Install dependencies:
npm installStart the Next.js app:
npm run devOpen http://localhost:3000.
Generate frontend bindings after schema or reducer signature changes:
npm run spacetime:generatePublish the current module without wiping existing data:
npm run spacetime:publishPublish to local SpacetimeDB without wiping data:
npm run spacetime:publish:localIf you explicitly need to clear the database during publish:
npm run spacetime:publish:reset
# or
npm run spacetime:publish:reset:local/login/[[...rest]]for sign-in/register/[[...rest]]for sign-up/sso-callbackfor Clerk redirect callbacks/dashboard/*for authenticated member pages
Useful checks before pushing:
npm run lint
npm run build.env.localstays local and should not be committed.spacetimedb/src/admin.tsstays local and should not be committed..env.exampleis the committed template for onboarding other environments.