GithubHelp home page GithubHelp logo

clerk / remix-bossa-nova-stack Goto Github PK

View Code? Open in Web Editor NEW
49.0 2.0 5.0 17.06 MB

The Remix Stack with Clerk authentication, Supabase database, Chakra UI, testing, linting, and more.

Home Page: https://bossa-nova-stack.clerk.app

TypeScript 15.75% JavaScript 84.25%
remix-stack chakra-ui clerk supabase vercel postgres

remix-bossa-nova-stack's Introduction

Remix Bossa Nova Stack

Learn more about Remix Stacks.

What's in the stack

Development

Installation

Create a new Remix app using the Bossa Nova Stack template:

npx create-remix@latest --template clerkinc/remix-bossa-nova-stack <app-name>

Environment variables

For this step, you'll need a Clerk application. Check out the Clerk docs for more information about setting it up.

You'll also need a Supabase project.

Finally, if you've already entered your environment variables during the Installation step, this step can be skipped.

Navigate into your project directory:

cd <app-name>

Create a .env file:

touch .env

Find your Clerk Frontend API key and Backend API key and your Supabase URL and anon key and add them to that file like this:

CLERK_FRONTEND_API=<YOUR_FRONTEND_API_KEY>
CLERK_API_KEY=<YOUR_BACKEND_API_KEY>
SUPABASE_URL=<YOUR_SUPABASE_URL>
SUPABASE_ANON_KEY=<YOUR_SUPABASE_ANON_KEY>

Configuring the database

This template comes pre-configured to make calls to a Supabase database.

To make authenticated calls to a Supabase database, you'll need to use one of Clerk's handy JWT Templates. Check out our detailed instructions about setting up Clerk and Supabase.

โ—๏ธ This project is configured to use a JWT template named supabase, so use the same value when creating your JWT template on the Clerk Dashboard. Alternatively, you can change this value in /app/utils/db.server.ts.

Also, you'll need to create a table called bossa_nova_songs with the following columns in your Supabase database:

Column name Column type Default value
id uuid uuid_generate_v4()
created_at timestamptz now()
user_id text
body text

In the end, it should look like this:

App's screenshot

Next, we need to ensure that only authenticated users can add new songs and that these users can only retrieve songs they've added. For that, we'll enable RLS for the newly created bossa_nova_songs table. Head over to the SQL editor on your Supabase project, paste and run the following query:

create or replace function requesting_user_id()
returns text
language sql stable
as $$
  select nullif(current_setting('request.jwt.claims', true)::json->>'sub', '')::text;
$$;

This will create a requesting_user_id() function that can be used within an RLS policy.

Now, navigate to "Authentication", then "Policies", enable RLS for the bossa_nova_songs table, if not yet enabled, and create two new policies from scratch.

One for inserting new songs:

Insert policy

And one for selecting existing songs:

Select policy

Your database is now fully configured and protected.

Running the app

Start your development instance:

npm run dev

Visit http://localhost:3000. If everything is set up correctly, you should see something that looks like this:

App's screenshot

That's it! You're all set to start building your Remix application with complete user management provided by Clerk.

Styling

This template is pre-configured to use Chakra styling. For more information about it, check out the Chakra documentation.

Deployment

You only need to import your Git repository into Vercel, and it will be deployed.

If you'd like to avoid using a Git repository, you can also deploy the directory by running Vercel CLI:

npm i -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.

Testing

Cypress

Cypress is used for the End-to-End tests in this project. You'll find those in the cypress directory. You'll find included Cypress's example files to help you on your way, but for more information on Cypress, check out their official documentation.

Jest/Testing Library

For lower level tests of utilities and individual components, this project uses Jest and Testing Library.

Type Checking

This project uses TypeScript. It's recommended to get TypeScript set up for your editor to get a really great in-editor experience with type checking and auto-complete. To run type checking across the whole project, run npm run typecheck.

Linting

This project uses ESLint for linting. That is configured in .eslintrc.js.

Formatting

This project uses Prettier for auto-formatting in this project. It's recommended to install an editor plugin (like the VSCode Prettier plugin) to get auto-formatting on save. There's also a npm run format script you can run to format all files in the project.

remix-bossa-nova-stack's People

Contributors

marcelscruz avatar perkinsjr avatar ryan-snyder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

remix-bossa-nova-stack's Issues

Update .env.example variable names

After creating a copy of this repo, I had to update the Clerk environment variables to CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY to get things working. Is this a default naming scheme that the @clerk/remix client looks for?

This starter template is out of date

Just to save anyone else the time and trouble, this starter template is really out of date from both the Clerk perspective. The installed version of Clerk in this stack is 2 major version behind the latest release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.