⏪ Rewinds is no longer maintained since Remix v2. Check out the continuation on 🐶 Dogokit / 🐶 Dogokit Remix
⏪ Rewinds is a web app starter kit with mainly Remix and Tailwind CSS. Visit the demo at rewinds.mhaidarhanif.com.
This template can still be used as is and quite stable with Remix v1, but will not be updated anymore. See the latest continuation of this starter as 🐶 Dogokit, one of them is being 🐶 Dogokit Remix.
The goal is to be as productive as possible to ship things fast. So it is a highly opinionated collection of software engineering and web development workflow, interactive UI components, functionality hooks and utilities.
Use this to build any web apps:
Starting new? Use this template to generate the repository.
Clone?
git clone [email protected]:mhaidarhanif/rewinds.git
Use npx
?
npx create-remix@latest --template mhaidarhanif/rewinds
Deploy quickly?
Then make sure to explore the repo to rename and replace the contents along the way. As this is a template, not a blank repo generator.
The main prerequisites to learn, understand, and use with the stack.
If you work as a team, I recommend to:
.env
file. If you need to share quickly EnvShare is good.(Architecture diagram can help later on here)
The complete stack are Node.js, TypeScript, Remix, Remix Auth, React, Tailwind CSS, Radix UI, Zod, Conform, Prisma ORM, PlanetScale, and Vercel. We also aim to prioritize which has open source option, free-tier, or freemium. Check the GUIDE.md if you need more info on the project setup, structure, and files.
Legends:
Although these are not included, if you need a separate backend/server/service, here are the recommendations:
Included features for the end users:
Included setup for the developers:
robots.txt
canonical
tagsitemap.xml
generatorRecommended external setup:
Optional workflow setup:
This repo is kind of over-engineered to have high flexibility and cover a lot of use cases for different applications/projects/products, especially what I'm working with several other people.
The components are using shadcn UI as the base components style. And the setup for full stack app development is mostly inspired by T3 Stack. The main difference is this repo example uses Remix by default, not Next.js like those two.
Before running your Remix app locally, make sure your project's local dependencies are installed using your preferred package manager agent:
npm install
yarn install
pnpm install
Or if using ni
which can autodetect the agent:
pnpm add -g @antfu/ni # Install once globally
ni # Will auto choose npm/yarn/pnpm
These are the main environment variables you need to set up on your own for developing locally:
DATABASE_URL
UPLOADCARE_PUBLIC_KEY
To manage the environment variables, you can either use:
.env
file.env
fiecp -i .env.example .env
# -i or --interactive will ask before overwrite
Then edit .env
as you need.
Alternatively, it's recommended to use Doppler, or Dotenv, or something similar to manage the credentials. Especially if you're working with a team.
doppler login
doppler setup
To use the secrets directly:
doppler -- pnpm <command>
To download the secrets into the .env
file:
doppler secrets download --no-file --format env > .env
⚠️ Make sure to setup the environment variables/secrets here, on Vercel, or on your preferred deployment target. Otherwise the app will break on production. That's why a secrets management platform is recommended to manage them easily. There are also some preset strings in the
.env.example
which you can copy directly.
It's up to you which database/DBMS you want to use with the app that supported by Prisma ORM. This repo is suited to use either your own MySQL instance or MySQL on PlanetScale. But don't use SQLite because it doesn't have @db.Text
annotation and model.createMany()
function.
Once you have the database URL connection string from PlanetScale MySQL instance, for example:
DATABASE_URL
from there.DATABASE_URL
to the environment variables.DATABASE_URL='mysql://username:[email protected]/name?sslaccept=strict'
Run Docker service and run Docker Compose script:
docker compose up
While in development, you can:
@prisma/client
with nr prisma:generate
(it runs prisma generate
)nr docs:prisma
(it runs prisma-docs-generator serve
) then open http://localhost:5858nr prisma:push
(it runs prisma db push
)This repo using Uploadcare to primarily upload and host the uploaded images and files. If you want the upload component to run, you need to paste your Public API key to UPLOADCARE_PUBLIC_KEY
env var.
UPLOADCARE_PUBLIC_KEY
to the environment variables.Make sure you've generated the latest Prisma schema with nr prisma:generate
.
Afterward, start the Remix development server like so based on your preference:
nr dev
nr dev-hmr
Without HMR, it will just run remix dev
, the Remix server on development. Then wait until you see this:
Loading environment variables from .env
Remix App Server started at http://localhost:3000
Open up http://localhost:3000 and you should be ready to go!
Alternatively, you can enable/disable HMR by changing this in the remix.config.js
. By default we're not using it.
const isUsingHMR = false;
With HMR, it will run both dev:remix
and dev:express
, the Remix server and the Express server with HMR enabled. Then wait until you see this:
📀 Remix on Express server port :3000
Loading environment variables from .env
💿 Built in 0s
Open up http://localhost:3000 and you should be ready to go!
When you update some significant changes in the TypeScript config, ESLint config, or just generated a new Prisma schema, you can restart the language server as needed:
> TypeScript: Restart TS Server
> ESLint: Restart ESLint Server
> Prisma: Restart Language Server
Look up for these comments:
EDITME
: You can edit them based on your needTODO
: You can see that they are in progressAs this repo was made after having run the create-remix
command and selected "Vercel" as a deployment target, you only need to import your Git repository into Vercel, and it will be deployed. Alternatively you can just use the "Deploy to Vercel" button above.
Just keep in mind to set up the environment variables/secret that preferably differentiated for each server environments such as local/development, staging/preview, and production.
Required for the app to run:
# Primary database that connects to Prisma ORM
DATABASE_URL=
# Session secret for cookie after authenticated or logged in
REMIX_SESSION_SECRET=
# Application name
REMIX_APP_NAME=
# Application transactional email
REMIX_APP_EMAIL=
# Upload image assets solution
UPLOADCARE_PUBLIC_KEY=
The session secret for REMIX_SESSION_SECRET
can be generated more securely using either Node.js crypto module (JS) or OpenSSL (shell):
$ node scripts/generate-secret.js
1234567890abcdefghijklmnopqrstuvwxyz1234567890
$ sh scripts/generate-secret.sh
yjudrrKv/W4jxzmQqXze9T7DEANxStDtg4YCdfgs/4E=
When managing environment variables/secrets using Doppler, there's the auto sync integration to Vercel:
If you'd like to avoid using a Git repository, you can also deploy the directory by running Vercel CLI:
ni -g vercel
vercel
It is generally recommended to use a Git repository, because future commits will then automatically be deployed by Vercel, through its Git Integration.
To make it automatic for Vercel CI to push the database schema changes (especially to PlanetScale) while building for Preview and Production, you can setup the build command to use the build:ci
script instead of regular build
.
Put this into the Build Command in the Project Settings:
pnpm build:ci
(Change pnpm
to your package manager of choice)
Use uicolors.app or tints.dev to generate the color tokens easily. Then replace what's inside tailwind.config.js
.
module.exports = {
theme: {
extend: {
colors: {
brand: {
50: "#f2f9fd",
// ...
950: "#0c1c27",
},
surface: {
50: "#f4f8f9",
// ...
950: "#040506",
},
},
},
},
};
This repo already has the entry files. Since Remix v1.14
, you might notice that the entry files might be able to be implicitly defined. At the moment, I still suggest revealing or explicitly defining them to make it work smoothly.
npx remix reveal
As there's no official way yet to handle SEO related output for metadata and sitemap, here are the options ordered by preference:
balavishnuvj/remix-seo
: Collection of SEO utilities like sitemap, robots.txt, etc. for a Remix Applicationchaance/remix-seo
: A package for easily managing SEO meta and link tags in Remixfedeya/remix-sitemap
: Sitemap generator for Remix applicationsSyntax to backup using PlanetScale's pscale
CLI:
pscale db dump database_name branch --output database_name.dump
For example:
pscale db dump rewinds main --output rewinds.dump
Also attempt to learn from others like Next.js, NestJS, Passport, tRPC, GraphQL, Swagger (OpenAPI), etc.
Some other public repos/projects using Rewinds:
M Haidar Hanif (@mhaidarhanif)
"Software is a just a tool to help accomplish something for people - many programmers never understood that. Keep your eyes on the delivered value, and don’t over focus on the specifics of the tools" — John Carmack