Developers

Self-hosting

Run Litestore on Vercel, in Docker or on your own server. The data stays yours.

Before you start

What you'll need

Litestore is one app that uses a few outside services, and most of them have free plans.

Postgres 15+

Litestore stores your orders and customers here.

S3 storage

You can use any S3-compatible storage, like R2 or MinIO.

Postgres 15+Your data
RedisCache and rate limits
S3 storageImages
LitestoreOne Next.js app
StorefrontAdmin
ResendEmail and sign-in links
InngestBackground jobs
StripeOptional
Resend

It sends order emails and sign-in links.

Stripe

Shoppers can browse without it. Add it when you want to take payments.

Local

Run it on your computer

You can have a working store on your computer in a few minutes.

  • Docker starts Postgres for you.
  • The seed script adds sample products.
~/litestore
$
Configuration

Your .env.local

The store won't start until every required key is set.

  • You can leave the Stripe keys empty until you want to take payments.
  • Nobody can sign in until Resend is set up.
.env.local
1# Your store's public address
2NEXT_PUBLIC_SITE_URL=https://your-store.com
3# Your public contact email
4NEXT_PUBLIC_SITE_EMAIL=hello@your-store.com
5# Your Postgres connection string
6DATABASE_URL=••••••••••••
7# Sign-in address and the secret that signs sessions
8BETTER_AUTH_URL=https://your-store.com
9BETTER_AUTH_SECRET=••••••••••••
10# Your Upstash Redis details
11REDIS_REST_URL=••••••••••••
12REDIS_REST_TOKEN=••••••••••••
13# Sends email. Without it, nobody can sign in
14RESEND_API_KEY=••••••••••••
15RESEND_SENDER_EMAIL=••••••••••••
16# Where images are stored
17S3_REGION=auto
18S3_BUCKET=••••••••••••
19S3_ACCESS_KEY=••••••••••••
20S3_SECRET_ACCESS_KEY=••••••••••••
21# Lets checkout take payments (optional)
22STRIPE_SECRET_KEY=••••••••••••
23STRIPE_WEBHOOK_SECRET=••••••••••••
Production

Go live

Once it works on your computer, you can put it online on Vercel or any Node.js server.

Update the database first

Run bun run db:deploy before the app starts.

Keep the app near its data

Run the app in the same region as Postgres. On Vercel, you set the region in vercel.json.

  1. Databasebun run db:deploy
  2. 2Buildbun run build
  3. 3Startbun run start
  4. 4Background jobs/api/inngest
  5. 5Test orderSign in and buy
Connect background jobs

Point Inngest at /api/inngest so emails and scheduled tasks keep running.

Place a test order

Buy something yourself to check it all works.

What you look after

When you host Litestore yourself, these jobs are yours.

Ongoing
Updates

Pull new changes from GitHub when you're ready.

Backups

Back up your database regularly. Most hosts can do it for you.

Keys

Keep secrets out of your code, and rotate them if they leak.

HTTPS

Serve your store over HTTPS. Vercel does this for you.

Stuck somewhere?

Our troubleshooting guide covers the problems people hit most.