/v6-app

Primary LanguageTypeScriptMIT LicenseMIT


V6 App

A fullstack, multi-app, monorepo dedicated to streamline your development process and satisfy all your needs ;)

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

It's basically JUST A MONOREPO.

This project was built based on my needs in my software development experience. Most often, real world software projects require multiple apps to be built. Say, if you're building a web application such as an e-commerce, chances are you would need to also build an admin/back office system, and these applications are likely to be connected to an API. So why not bundle them all up in a monorepo, while creating reusable packages to make development changes faster and easier?

I only made a template for you. Make any changes you want.

The default template features a NextJS and NestJS app. The package folder will contain code that should be reusable across apps. My personal favorite is the api package which bundles and exports react-query queries and mutations to be used across multiple frontend apps (assuming you're using React). Write queries and mutations once, import, and use them in your frontend apps. No more broken API requests because you forgot to implement a few params changes.

(back to top)

Built With

  • pnpm
  • Turborepo
  • NextJS
  • NestJS
  • Prisma
  • Supabase

(back to top)

⚠️Sections below are under construction⚠️

Getting Started

One thing to note is that this stack is kind of opinionated, but you are completely free to tweak anything according to your needs and preferences. For example, this stack heavily depends on Supabase for auth and file storage, but you are still free to setup/build your preferred way of handling auth and storage.

The instructions below will mostly cover the default pre-configured frameworks and libraries I personally chose as the starting template of the V6 Stack.

Prerequisites

  • pnpm
  • docker (optional, for supabase local development)

Setup and installation

1. Install packages

$ pnpm install

2. Setup env files

Several .env.template files have been created for you. Create your own .env to be used in your project. Adjust the needed values accordingly.

3. Initialize supabase

To develop using supabase locally, a supabase config is provided inside the server app. Navigate to the server folder and run

npx supabase start

to start your own local supabase instance through docker. Run

npx supabase stop

inside the server folder to shutdown the containers. For more guides and reference please refer to their official docs.

4. Prisma Migrate

Create a Prisma migration to sync changes in your schema.prisma to your database. Navigate to the db package and run this command.

pnpm db:migrate

5. Supabase Auth

If you're using supabase's auth service, chances are you also want to store your user's data inside your database's public schema. A minimal SQL function and trigger has been provided for you inside apps/server/supabase/triggers .

-- handle_new_users.sql
-- inserts a row into public.Profile
create function public.handle_new_user()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
  insert into public."Profile" ("userId")
  values (new.id);
  return new;
end;
$$;

-- trigger the function every time a user is created
create trigger on_auth_user_created
  after insert on auth.users
  for each row execute procedure public.handle_new_user();

Run this query on your database to duplicate a user's data every time a user signs up using supabase auth.

(back to top)

Usage

Please refer to our non-existent Documentation. We're working on it, I promise.

(back to top)

Roadmap

  • Separate Supabase to a package
  • Add a reusable ui package
  • Properly implement reusable configs
    • eslint
    • tsconfig
  • ✨ create-v6-app CLI ✨

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/entry-point-community/v6-app

(back to top)

Acknowledgments and references

(back to top)