Hey maker, welcome to ShipFastCheap 👋
Here's a quick overview of the boilerplate. Follow along to get your app up and running.
Once you're done, start with this tutorial to launch your project in 5 minutes. Let's build that startup, FAST ⚡️
This boilerplate uses app router and Nextjs 14.

Start a local server

1. In your terminal, run the following commands one-by-one:
1 2 3 4 5 git clone https://github.com/Marc-Lou-Org/ship-fast-ts.git [YOUR_APP_NAME] cd [YOUR_APP_NAME] npm install git remote remove origin npm run dev
ShipFastCheap requires Node 18.17 or greater. Type node -v in your terminal to check version.
2. Rename .env.example to .env.local
1 mv .env.example .env.local
3. Go to the Supabase dashboard, create a new project and paste your 2 Supabase environment variables NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY in .env.local
4. Open http://localhost:3000 to see your site. And voila!
You will see errors in the console but nothing important.

NextJS project structure

  • /app → Pages (1 folder + page.js = 1 page)
  • /app/api → API calls (1 file = 1 API endpoint)
  • /components → React components
  • /libs → Libraries helper functions (Stripe & Mailgun, auth etc.)
  • /app/(home) → Landing page
  • /app/dashboard → Admin space
  • /app/(how-to) → These docs (remove if you don't need them))

config.js

It is where you configure your app. Each key is documented to know how and why it's used. Have a thorough look at it: it is the backbone of the app.

.env file

Rename the .env.example file to .env.local. Change NEXTAUTH_SECRET to anything else. The file content should look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 NEXT_PUBLIC_SITE_URL=http://localhost:3000 NEXT_PUBLIC_SUPABASE_ANON_KEY= NEXT_PUBLIC_SUPABASE_URL= SUPABASE_SERVICE_ROLE_KEY= NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= STRIPE_SECRET_KEY= STRIPE_WEBHOOK_SECRET= STRIPE_BACKUP_CODE= GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= MAILGUN_API_KEY= MAILGUN_DOMAIN= NEXT_PUBLIC_MAILGUN_SUPPORT_EMAIL=
Now go ahead and follow this tutorial to get your startup live within 5 minutes!

Database setup

  • In your [Supabase] go to [Database]
  • Go to [Functions] on the left panel
  • Click [Create new function]
  • Name the function handle_new_user
  • Paste below code
  • 1 2 3 4 5 begin insert into public.users (id, full_name, avatar_url, role) values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url', 'user'); return new; end;
  • Hit [Confirm]
Now, everytime a new user logs in, a new record will be stores in table users.