- TypeScript 95.1%
- CSS 4.6%
- Dockerfile 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| data | ||
| docs | ||
| prisma | ||
| public/uploads | ||
| scripts | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| Dockerfile | ||
| eslint.config.mjs | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| prisma.config.ts | ||
| README.md | ||
| tailwind.config.ts | ||
| tsconfig.json | ||
Partner Carrd
A self-hosted portfolio, link hub, and lightweight storefront builder.
Create a personal website, tell the story behind your projects, and manage content, media, analytics, and orders from one workspace.
Features · Architecture · Setup · Deployment · Documentation
About the project
Partner Carrd is a self-hosted portfolio, link hub, and lightweight storefront builder. It combines a block-based visual editor with a public website, managed media, first-party analytics, content history, database backups, and optional Stripe Checkout.
The application is built around one website and one admin workspace. A creator can shape a landing page, publish detailed project case studies, organize links, and manage a small merchandise catalogue without editing React components for every content change.
This checkout is maintained for personal use. The earlier plan to sell a separate self-hosted customer edition is archived under old/customer-sales/, including its exporter, buyer documents, and release tests. It is no longer part of the active npm commands. See old/README.md for the archive inventory and restoration notes.
The engineering scope extends beyond rendering a page: the same application validates content, processes uploads, manages authenticated changes, records visitor activity, and supports recovery when an edit or deployment goes wrong.
This is an independent project inspired by the simplicity of one-page website builders. It is not affiliated with Carrd.
Features
From one private admin workspace, you can compose and publish a responsive website without editing source code:
- Build pages from hero, links, text, gallery, portfolio, contact, merchandise, and custom sections
- Reorder sections with drag and drop and start quickly from section templates
- Control colors, typography, spacing, cards, navigation, backgrounds, and intro effects
- Upload images through a managed pipeline that creates WebP display, preview, thumbnail, and hero variants
- Create dedicated portfolio case-study pages at
/portfolio/[slug] - Schedule links, target them by device or country, and configure A/B variants
- Manage SEO metadata, social previews, the favicon, and footer content
- Track privacy-minded first-party analytics without a third-party analytics account
- Restore prior content versions and create, download, or restore SQLite backups
- Sell merchandise through optional hosted Stripe Checkout and manage order fulfillment
Visual editing and portfolio presentation
The editor uses reusable block types for hero sections, links, text, galleries, contact details, portfolio projects, merchandise, and custom sections. Theme presets and section templates provide starting points; individual cards, image crops, focal positions, spacing, and navigation can then be adjusted to fit the site.
Portfolio entries support project images, descriptions, status labels, technology tags, live links, and source-code links. Dedicated case-study pages give projects room for more detail than a homepage card. Rich text supports sanitized media, including supported video embeds and uploaded MP4/WebM files.
Analytics and publishing operations
Analytics distinguishes page loads from section views and reports browser-based visitor counts, referrals, outbound activity, and store conversions. An optional offline country database supports geographic reporting without sending visitor IP addresses to a remote lookup service. Country-targeted public links use a separate trusted-header mechanism; installing the analytics database alone does not enable that targeting.
Media management, editor snapshots, and database restore tools make ongoing site maintenance part of the product itself.
How it works
flowchart LR
ADMIN["Admin workspace"] -->|"Validated content and settings"| APP["Next.js application"]
APP --> DB[("SQLite / Prisma")]
ADMIN -->|"Media uploads"| MEDIA["Sharp and upload handlers"]
MEDIA --> FILES[("Local media files")]
DB --> SITE["Public site and case studies"]
FILES --> SITE
SITE -->|"First-party events"| APP
SITE -->|"Optional checkout"| STRIPE["Stripe"]
STRIPE -->|"Verified webhook"| APP
The public renderer reads a structured content model rather than a separately compiled page for each edit. The admin workspace updates that model through authenticated routes, while shared validation and sanitization keep the editor, saved data, and public output aligned.
Image uploads go through server-side processing that generates display variants. The database stores site configuration and application records; uploaded files and content snapshots live on disk. Optional checkout hands payment entry to Stripe, then records completed orders through the webhook flow.
Engineering decisions
- Next.js App Router powers the public site, admin workspace, and API routes in one application.
- Typed content model and Zod validation protect saved and imported site data.
- Prisma + SQLite provide a portable data layer with committed migrations.
- Server-side image processing uses Sharp to validate uploads, strip metadata, and generate optimized variants.
- Content recovery includes the newest 30 editor snapshots plus independent full-database backups.
- Security controls include hashed passwords and sessions, login throttling, same-origin checks, upload validation, path and URL sanitization, restrictive headers, and session revocation after password changes.
- First-party analytics stores page views, outbound clicks, referral hosts, approximate unique visitors, location, device, browser, section activity, and store conversions locally.
Keeping the public site, editor, and API in one Next.js application reduces deployment overhead for a single-owner website. Shared TypeScript models connect the editor to the renderer, while the block registry and templates make it possible to extend content types without treating each page as unrelated markup.
SQLite and local files make an instance easy to inspect and move, but require persistent storage and coordinated backups. Editor history and database snapshots solve different recovery problems: content rollback is convenient for editorial mistakes, while a complete instance backup also needs uploads and deployment settings.
Project scope
Partner Carrd deliberately favors a focused, maintainable architecture over becoming a general-purpose website platform.
| In scope | Out of scope |
|---|---|
| One public website and one admin workspace | Multi-tenant accounts or customer workspaces |
| Creator portfolios, link hubs, and small storefronts | A general-purpose CMS or page builder |
| Self-hosting on a single persistent instance | Serverless deployments with ephemeral storage |
| Local SQLite data, uploads, history, and backups | Horizontally scaled database and object storage |
| Optional Stripe-hosted checkout | Inventory, shipping, tax, or marketplace management |
| First-party traffic and conversion analytics | Enterprise analytics or behavioral replay |
This scope keeps the application straightforward to deploy, inspect, customize, and back up. For higher traffic or multiple application replicas, SQLite and filesystem storage should be replaced with shared production services.
Technology
| Layer | Technology |
|---|---|
| Framework | Next.js 16, React 19 |
| Language | TypeScript |
| Styling | Tailwind CSS 4 |
| Database | SQLite, Prisma ORM 6 |
| Validation | Zod |
| Authentication | Cookie sessions, bcrypt |
| Media | Sharp |
| Payments | Stripe Checkout (optional) |
Repository layout
my-carrd/
├── old/ # Archived sales edition, legacy files, and local snapshots
├── prisma/
│ ├── migrations/ # Committed database migrations
│ └── schema.prisma # Application data model
├── public/uploads/ # Persistent managed media
├── scripts/
│ ├── backup.ts # Manual backup command
│ ├── maintenance.ts # Retention and scheduled backup tasks
│ └── seed.ts # Admin and starter-content seed
└── src/
├── app/ # Pages, layouts, and API routes
├── components/
│ ├── admin/ # Editor, panels, analytics, and order UI
│ └── site/ # Public site renderer and portfolio pages
├── hooks/ # Site-builder state and client hooks
├── lib/ # Auth, data, media, analytics, and validation
├── presets/ # Theme presets
├── templates/ # Section templates
└── types/ # Shared TypeScript models
Getting started
Prerequisites
- Node.js 22.13 or newer
- npm
1. Install the project
git clone <your-repository-url> my-carrd
cd my-carrd
npm ci
2. Create the environment file
On macOS or Linux:
cp .env.example .env
On PowerShell:
Copy-Item .env.example .env
The npm development and production scripts run the app on port 3001. Update the three URL values in .env accordingly:
APP_ORIGIN="http://localhost:3001"
NEXT_PUBLIC_SITE_URL="http://localhost:3001"
NEXT_PUBLIC_APP_URL="http://localhost:3001"
Before seeding, replace the default admin password:
SEED_ADMIN_USERNAME="admin"
SEED_ADMIN_PASSWORD="use-a-long-unique-password"
ANALYTICS_SALT="use-a-long-random-value"
Do not commit .env; it contains secrets and is already ignored by Git.
3. Initialize the database
npm run setup
This command generates the Prisma client, applies the schema to SQLite, creates or updates the admin account, and adds starter content when the site is empty. Existing content is preserved unless SEED_OVERWRITE_CONTENT is set to true.
4. Start the application
npm run dev
Open the public site at http://localhost:3001 and the editor at http://localhost:3001/admin.
Configuration
The defaults and optional seed settings live in .env.example.
| Variable | Required | Purpose |
|---|---|---|
DATABASE_URL |
Yes | SQLite datasource used by Prisma. Verify the resolved location against the Prisma configuration; use an absolute file URL when the deployment needs an unambiguous path. |
APP_ORIGIN |
Production | Trusted origin for protected write requests and checkout redirects. |
NEXT_PUBLIC_SITE_URL |
Recommended | Canonical public URL used for metadata and links. |
NEXT_PUBLIC_APP_URL |
Recommended | Public application URL and fallback trusted origin. |
ADMIN_COOKIE_NAME |
No | Admin session cookie name. Defaults to pc_admin. |
ADMIN_COOKIE_TTL_DAYS |
No | Admin session lifetime in days. |
ADMIN_LOGIN_WINDOW_MS |
No | Time window used for login throttling. |
ADMIN_LOGIN_MAX_ATTEMPTS |
No | Failed attempts allowed within the login window. |
ADMIN_LOGIN_BLOCK_MS |
No | Lockout duration after the limit is reached. |
ANALYTICS_SALT |
Yes | Private salt used to derive privacy-minded visitor hashes. |
ANALYTICS_RETENTION_DAYS |
No | Analytics retention period; defaults to 365 days. |
DATABASE_BACKUP_RETENTION |
No | Number of SQLite backups to retain; defaults to 20. |
The SEED_* variables customize the initial admin account and starter page. The seed script accepts additional values for metadata, hero copy, about copy, and the two starter links; see scripts/seed.ts for the complete set.
In production, the seed script refuses to use the example password
change-me-now.
Country lookup and video media
Set ANALYTICS_GEOIP_DB to a private local MMDB file if you want country analytics. The npm run analytics:geoip helper downloads the DB-IP Country Lite data; attribution and provider details are covered in the analytics guide. The lookup database belongs outside public uploads.
Uploaded video support currently accepts detected MP4 and WebM containers, with a 100 MiB upload limit in the video validator. This is file hosting and playback, not a video transcoding service. Browser compatibility still depends on the codecs inside the uploaded container.
Development and verification
| Command | Description |
|---|---|
npm run dev |
Start the development server on port 3001 |
npm run build |
Create a production build |
npm start |
Start the production server on port 3001 |
npm run lint |
Run ESLint |
npm test |
Run security, builder, analytics, media, and editor-state regressions |
npm run setup |
Generate Prisma, sync the schema, and seed the site |
npm run seed |
Create/update the admin user and seed missing content |
npm run db:push |
Sync the Prisma schema without creating a migration |
npm run backup |
Create and validate a SQLite snapshot |
npm run maintenance |
Prune expired records and create a scheduled backup |
Run the existing checks from the project root:
npm run lint
npm test
npm run build
The analytics regression script checks reporting logic, while the rich-text/media script covers sanitization, video detection, and byte-range behavior. When a local country database is installed, npx tsx scripts/test-country-db.ts checks that lookup separately.
For a manual smoke test, sign in to the editor, change a section, save it, and inspect the public page. Then upload an image, open a portfolio case study, and verify that visitor activity appears in analytics. Exercise Stripe checkout separately in test mode if the store is enabled. Run builds in a development checkout or stop the deployed process first, because Next.js writes into .next.
Deployment
Node.js deployment
Use a persistent host, install dependencies, provide the environment file, and apply committed migrations before the production build:
npm ci
npx prisma generate
npx prisma migrate deploy
npm run build
npm start
On a new instance, seed the admin account and starter content after configuring the seed credentials. The seed command can update an existing admin password, so treat it as an intentional account operation rather than an automatic step in every release.
The process listens on port 3001. Put it behind a TLS reverse proxy and configure the public URL variables to match the external HTTPS origin. Keep SQLite, uploads, and history on persistent storage, and schedule the maintenance command described below.
Docker deployment
The Dockerfile builds a Node.js 22 Linux image containing the standalone Next.js server. Docker Compose publishes it at 127.0.0.1:3001, so a reverse proxy on the host can continue using that address. The server runs as the unprivileged node user, with a health check and an unless-stopped restart policy.
For an existing initialized site, run these commands from the project folder on the Docker host:
docker compose build site
docker compose run --rm --no-deps site node node_modules/prisma/build/index.js migrate deploy
docker compose up -d --wait site
docker compose ps
docker compose logs --tail 100 site
The database, backups, uploads, and history stay in the existing host folders through bind mounts. The image excludes live data, .env, and archived material. Compose supplies .env at runtime and overrides the database URL with the Linux container path; public NEXT_PUBLIC_* values are also passed at build time. Take a consistent database backup before applying migrations. Startup does not run db push or reseed accounts.
See Docker deployment and recovery for the current Windows server, backups, updates, and SSH-specific Docker configuration. Native development still uses npm run dev; standalone output is enabled only for the Docker build.
Optional Stripe checkout
Stripe is optional; the rest of the application works without it.
- Open Admin → Payments and enter the Stripe publishable key, secret key, and webhook signing secret.
- Enable Stripe and choose the store currency.
- Add a Stripe Price ID to each merchandise item that should be purchasable.
- Register
https://your-domain.example/api/store/webhookas a Stripe webhook endpoint.
Checkout uses Stripe's hosted payment page. Completed sessions are recorded as orders and can be reviewed and marked fulfilled in the admin workspace. Secret values remain server-side and are not returned to the browser after saving.
Data and recovery
Persistent application state is stored in four places:
| Path | Contents |
|---|---|
.env |
Deployment configuration and secrets |
prisma/ |
SQLite database, migrations, and private database backups |
public/uploads/ |
Original uploads and generated image variants |
data/ |
Content version history |
For a complete instance backup, preserve all four locations. Editor history is useful for rolling back content mistakes, but it does not replace a full backup of the database, uploads, and secrets.
You can create and restore database snapshots from Admin → Site settings → Backups. The restore flow verifies SQLite integrity and migration compatibility and creates a recovery snapshot before replacing the live database.
For long-running deployments, schedule:
npm run maintenance
It removes expired sessions, stale login-attempt records, and analytics events older than the configured retention period, then creates a validated database backup.
Security and privacy
The admin workspace uses hashed passwords and hashed session tokens, login throttling, same-origin checks for protected writes, and session revocation after password changes. Content and media handlers validate input and sanitize URLs and rich text before it reaches the public renderer.
First-party analytics does use browser storage: a random browser identifier is stored in a cookie and local storage, then hashed for analytics records. It is not a count of identified people, and clearing browser storage can create a new visitor. Raw IP addresses are not stored in analytics. Describe this behavior in the site's privacy and consent configuration as appropriate for the deployment.
Stripe credentials and database backups are private application data. Keep environment files and snapshots out of public upload directories, and expose the application through trusted infrastructure when using forwarded IP or country headers.
Current limitations
- One site and one admin workspace are the intended operating model; this is not a multi-tenant website-hosting service.
- SQLite and local uploads require a persistent instance. Multiple application replicas need a shared persistence design.
- The storefront provides hosted checkout and order fulfillment status, not a complete inventory, shipping, or tax-management system.
- Geographic analytics are approximate. Public country targeting needs a trusted country header, independently of the offline analytics database.
- Video uploads are not automatically transcoded into multiple resolutions or codecs.
- The focused regression scripts do not replace a complete end-to-end suite for editing, checkout, and recovery.
Troubleshooting
| Symptom | What to check |
|---|---|
| Admin writes or checkout redirects fail | Align APP_ORIGIN and both public URL variables with the URL actually used in the browser. Local npm scripts use port 3001. |
| Prisma cannot open SQLite | Check the resolved DATABASE_URL, parent directory, and write permissions. Keep the same datasource for migration, seed, and runtime commands. |
| Seeded credentials are unexpected | Verify the seed process receives the intended SEED_ADMIN_* values. Seeding can update the admin account. |
| Country analytics are unknown | Configure the private MMDB file or a trusted country header, then restart the application. Historical events cannot be geolocated retroactively. |
| Country-restricted links disappear | Verify the public visitor-context country header; the analytics MMDB is not used for public link targeting. |
| Uploads disappear after deployment | Preserve public/uploads/ across releases and container replacement. |
| A paid order is missing | Check the Stripe webhook URL, signing secret, delivery logs, and matching test/live configuration. |