• Stars
    star
    1
  • Language
    TypeScript
  • Created over 2 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Remix K-pop Stack

k-pop site image

Deployed Site: kpop-stack.netlify.app

Learn more about Remix Stacks.

npx create-remix --template netlify-templates/kpop-stack

Click this button to create a new Github repo, new Netlify project and deploy this stack to a CDN.

Deploy to Netlify Button

What's in the stack

Not a fan of bits of the stack? Fork it, change it, and use npx create-remix --template your/repo! Make it your own.


Development

  • Install all dependencies & the Netlify CLI:

    npm install
    npm install netlify-cli -g
  • Create or connect to your Netlify project by running through the Netlify init script:

    netlify init
  • Add your Supabase and session environment variables to a .env file like .env.sample file or through the Netlify project dashboard at https://app.netlify.com/ Site settings/Build & deploy/Environment:

    SUPABASE_URL=""
    SUPABASE_ANON_KEY=""
    SESSION_SECRET=""
    

There is more information about the Supabase variables in the Database section below. The initial create-remix command will create the SESSION_SECRET variable which is a random string of 16 characters, so feel free to just set a random 16 chars if not running remix-create.

Environment Variable list in project dashboard.

screenshot of env vars in Netlify UI

  • Start dev server:

    npm run dev

This starts your app in development mode, rebuilding assets on file changes.

Running Locally

Running npm run dev will also trigger the Netlify local development environment which will pull in all the environment variables of your Netlify project. You can learn more about this project's Supabase environment variables in the Database section below. With Netlify dev you can also:

  • test functions
  • test redirects
  • share a live session via url with netlify dev --live
  • and more :)

Relevant code:

This is a pretty simple note-taking app, but it's a good example of how you can build a full stack app with Remix and Supabase. The main functionality is creating users, logging in and out, and creating and deleting notes.


Database

This project uses Supabase for data storage and user authentication.

Environment Variables

You will need these 2 environment variables to connect to your Supabase instance:

  • SUPABASE_ANON_KEY:

    Found in Settings/API/Project API keys

    See screenshot

    supabase anon key location

  • SUPABASE_URL:

    Found in Settings/API/Configuration/URL

    See screenshot

    supabase url location

You can add your environment variables to an .env file (like shown in the sample .env.sample) which will not be committed publicly because it is added to the .gitignore file. Or you can add it to your Netlify project environment variables (Site settings/Build & deploy/Environment) as shown in the Development section so that they can be easily shared with teammates.

Database creation
  • You can sign up with Supabase with your GitHub credentials

  • Create a new project on the 'Project' page

    CleanShot 2022-03-31 at 11 54 36

  • Next you will need to name the database and makes sure to save the password you select, then you will want to choose a region closes to you

    CleanShot 2022-03-31 at 11 55 47

  • It will take some time for the project to be fully scaffold so you will need to wait before the next steps.

SQL Queries
  • In your Supabase project dashboard, you can find the SQL Editor here

    CleanShot 2022-03-31 at 11 57 16

  • Select "New Query"

    CleanShot 2022-03-31 at 11 59 29

  • Here are the SQL queries used in the K-pop Stack

    -- Create public profile table that references our auth.user
    create table public.profiles (
      id uuid references auth.users not null,
      created_at timestamptz not null default current_timestamp,
      email varchar not null,
    
      primary key (id)
    );
    
    -- Create public notes table
    create table public.notes (
      id uuid not null default uuid_generate_v4(),
      title text,
      body text,
      created_at timestamp default current_timestamp,
      updated_at timestamp default current_timestamp,
      profile_id uuid references public.profiles not null,
    
      primary key (id)
    );
    
    -- inserts a row into public.users
    create or replace function public.handle_new_user()
    returns trigger
    language plpgsql
    security definer set search_path = public
    as $$
    begin
      insert into public.profiles (id, email)
      values (new.id, new.email);
      return new;
    end;
    $$;
    
    -- trigger the function every time a user is created
    drop trigger if exists on_auth_user_created on auth.user;
    create trigger on_auth_user_created
      after insert on auth.users
      for each row execute procedure public.handle_new_user();
  • You can copy these over to the SQL Editor and click the 'Run' button

    CleanShot 2022-03-31 at 12 04 31

  • Lastly, you will need to go to 'Authentication and Settings', and switch off "Enable email confirmations" for the project

    CleanShot 2022-03-31 at 12 07 47


Deployment

This stack has the Netlify configuration file (netlify.toml) that contains all the information needed to deploy your project to Netlify's edge nodes.

Want to deploy immediately? Click this button

Deploy to Netlify Button

Clicking this button will start the setup for a new project and deployment.

Deploy from the Command Line

Clone this repo with the git clone command. Then install the Netlify CLI tool and run netlify init.

git clone https://github.com/netlify-templates/kpop-stack

npm install netlify-cli -g # to install the Netlify CLI tool globally

netlify init # initialize a new Netlify project & deploy

CI/CD

Using the 'Deploy to Netlify' button or the init process will also set up continuous deployment for your project so that a new build will be triggered & deployed when you push code to the repo (you can change this from your project dashboard: Site Settings/Build & deploy/Continuous Deployment).

You can also use netlify deploy or netlify deploy --prod to manually deploy then netlify open to open your project dashboard.

💡 If you don't use --prod on the deploy command you will deploy a preview of your application with a link to share with teammates to see the site deployed without deploying to production


Testing

Cypress

We have set up the basic configuration files for Cypress End-to-End tests in this project. You'll find those in the cypress directory. As you make changes, add to an existing file or create a new file in the cypress/integrations directory to test your changes.

We use @testing-library/cypress for selecting elements on the page semantically.

To run these tests in development, run npm run e2e-test which will start the dev server for the app as well as the Cypress client.

To other example of Cypress tests specifically on Remix stacks, check out the cypress directory in the Remix Grunge Stack example.

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

We use 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.

More Repositories

1

phpinsights

🔰 Instant PHP quality checks from your console
PHP
5,265
star
2

larastan

⚗️ Adds code analysis to Laravel improving developer productivity and code quality.
PHP
4,882
star
3

collision

💥 Collision is a beautiful error reporting tool for command-line applications
PHP
4,497
star
4

termwind

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
PHP
2,269
star
5

laravel-console-menu

🔘 Beautiful PHP CLI menus. Is a php-school/cli-menu wrapper for Laravel/Artisan Console Commands
PHP
794
star
6

skeleton-php

⚡️ This package provides a wonderful PHP skeleton to start building your next package idea.
PHP
647
star
7

laravel-desktop-notifier

💻 Send notifications to your desktop from your Laravel Artisan Commands. An JoliNotif wrapper for Laravel.
PHP
415
star
8

laravel-mojito

🍹 A lightweight package for testing Laravel views in isolation
PHP
373
star
9

pest

This repository contains an old version of PEST. A new and better version is being coded in private and will be out soon: https://github.com/pestphp/pest.
343
star
10

patrol

Patrol is an elegant command-line tool that keeps your PHP Project's dependencies in check.
PHP
266
star
11

laravel-console-task

✅ Laravel Console Task is a output method for Laravel Console Commands.
PHP
252
star
12

awesome-php-src

🚀 A curated list of awesome resources related to PHP source code
224
star
13

curryable

An elegant and simple curry(f) implementation in PHP.
PHP
175
star
14

dd

✨ The most popular way of debugging in PHP is now available in JavaScript.
JavaScript
159
star
15

yorn

⚗️ Modules in PHP with the `import` and `export` syntax
PHP
146
star
16

laravel-console-dusk

Laravel Console Dusk allows the usage of Laravel Dusk in Laravel/Laravel Zero artisan commands.
PHP
144
star
17

laracon-schedule

👨🏻‍🚀 A command-line tool that gives you the @LaraconOnline schedule in your timezone. 🚀
PHP
101
star
18

laravel-pot

Provides Artisan commands to inspect Laravel Application's container. 🪴
PHP
88
star
19

mock-final-classes

🏄‍♂️ Allows mocking final classes in PHP.
PHP
83
star
20

awesome-laravel-vapor

🚀 A curated list of awesome resources related to Laravel Vapor.
80
star
21

laravel-console-summary

📖 Beautiful Laravel Console Summary for Artisan or Laravel Zero.
PHP
62
star
22

collision-adapter-symfony

Collision's adapter for Symfony applications. Error Reporting for console/command-line PHP applications.
PHP
45
star
23

dig

👨🏻‍🎨 A beautiful debug tool for the command line.
PHP
40
star
24

laravel-any

🏓 Laravel collection macro that determine if `any` item from the collection passes the given truth test.
PHP
38
star
25

nunomaduro.com

Rust
34
star
26

skeleton-c

⚡️ This package provides a wonderful C skeleton to start building your next package idea.
Makefile
33
star
27

php-interminal

PHP Interminal is a command-line tool that gives you access to PHP Internals discussions in your terminal.
PHP
32
star
28

bombe

Bombe is a tool for benchmarking the given url response status and response time.
C
23
star
29

skeleton-js

👨🏻‍💻 A skeleton repository for my open source JavaScript packages
JavaScript
21
star
30

elegant-sublime

👔An collection of sublime text preferences
17
star
31

pint-strict-preset

Pint strict preset is an insanely defensive coding style preset for those who demand meticulous precision in their projects.
11
star
32

alpine-day-schedule

👨🏻‍🚀 A command-line tool that gives you the Alpine Day 2021 schedule in your timezone. 🚀
PHP
11
star
33

talks

🎤 My talks about PHP, Laravel or side projects of mine
10
star
34

laravel-meetups

🍕It's Meetup time! Find out Laravel Meetups near you!
PHP
8
star
35

laravel-console-spinner

❃ A spinning activity indicator for Laravel/Laravel Zero artisan commands.
7
star
36

laravel-optimize-database

💨 Publishes migrations that make your sqlite database production ready. it's a work-in-progress
PHP
6
star
37

laravel-9-test

PHP
5
star
38

forge-octane

PHP
5
star
39

friend.com

Blade
3
star
40

scout-extended-demo

PHP
3
star
41

skeleton-typescript

⚗️ The perfect starting for typescript libraries.
3
star
42

laravel-zero-weather

PHP
3
star
43

nextjs-blog-wqdqwdqwd

JavaScript
2
star
44

dotfiles

2
star
45

twitter-stream

An demo application of Laravel Zero that works with the Twitter Streaming API
PHP
2
star
46

skeleton-laravel

Just my Laravel skeleton
2
star
47

learn-javascript

2
star
48

my-site

HTML
1
star
49

vapor-github-test

PHP
1
star
50

qwdpowkqdopwqkd

JavaScript
1
star
51

skeleton-php-1

My PHP Package Skeleton
PHP
1
star
52

exclude-dev-files-bug

PHP
1
star
53

nunomaduro

1
star
54

helpers-tap

🚰 Tap that method
TypeScript
1
star
55

test

HTML
1
star
56

perna

🛋 Optimises the workflow around managing multi-package repositories.
1
star
57

demo-p

PHP
1
star
58

laravel-collections-examples

PHP
1
star
59

test-cs

PHP
1
star