A full-featured CRM built with React, shadcn/ui, and Supabase.
Feat(crm): Add supabase deploy scripts
Jonathan ARNAULTcad60d03742a
diff --git a/README.md b/README.mdindex cf7ae71f..411ae995 100644--- a/README.md+++ b/README.md@@ -1,4 +1,4 @@-# React-admin CRM+# Atomic CRMThis is a demo of the [react-admin](https://github.com/marmelab/react-admin) library for React.js. It's a CRM for a fake Web agency with a few sales. You can test it online at https://marmelab.com/react-admin-crm.@@ -8,67 +8,77 @@ React-admin usually requires a REST/GraphQL server to provide data. In this demoTo explore the source code, start with [src/App.tsx](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/App.tsx).-**Note**: This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).## Setup-After having cloned the react-admin repository, run the following command at the project root:+To run this project you will need the following tools installed on your computer:+- Make+- Node 20 LTS+- NPM+- Docker (required by supabase)-```sh-npm install-```---## Available Scripts--In the project directory, you can run:--### `npm start`+After having cloned the [`atomic-crm` repository](https://github.com/marmelab/atomic-crm), run the following command at the project root:-Runs the app in the development mode.<br>-Open [http://localhost:3000](http://localhost:3000) to view it in the browser.--The page will reload if you make edits.<br>-You will also see any lint errors in the console.+```sh+# Install dependencies+make install-### `npm test`+# Start the stack in development mode+make start+```-Launches the test runner in the interactive watch mode.<br>-See the section about [running tests](#running-tests) for more information.+## Remote Instance Setup-### `npm run build`+You can create a remote supabase using the following script:+```sh+make supabase-remote-init+```-Builds the app for production to the `build` folder.<br>-It correctly bundles React in production mode and optimizes the build for the best performance.+The script will prompt your for the project configuration and will apply migrations and deploy edge functions.-The build is minified and the filenames include the hashes.<br>-Your app is ready to be deployed!-### `npm run deploy`+## Manual Remove Instance Link-Create a remote Supabase project and initialize it with the migrations.+If you already created the supabase instance, you can link the instance manually using the following commands:-## Manual Deployment+First, login into your supabase account:-To deploy this application, you need a Supabase instance.+```sh+npx supabase login+```-Login into your supabase account:+Now, link this project to the local supabase instance. You'll be asked to enter the database password.+```sh+npx supabase link --project-ref ********************+```+Then, apply the migrations on it:```sh-npx supabase login+npx supabase db push+npx supabase functions deploy```-Then, create a new supabase project. Keep note of the database password you'll have to enter and of the supabase project reference.+Finally, create the `.env.production.local` file with your supabase configuration:+```sh-npx supabase projects create react-admin-crm+VITE_SUPABASE_URL=<instance_url>+VITE_SUPABASE_ANON_KEY=<instance_anon_token>```-Now, link this project to the local supabase instance. You'll be asked to enter the database password.+## Deploy Updates++If you want to deploy a new version of your CRM, you can run the following command:```sh-supabase link --project-ref ********************+make prod-deploy```-Finally, apply the migrations on it:+It will apply migrations, deploy edge functions and push the built applications to the `gh-pages` branch.++## Test Production Mode++If you want to test you application in production mode using the remote supabase instance, you can run the following command:```sh-supabase db push+make prod-start```++Note: It will apply migrations and deploy edge functions.diff --git a/makefile b/makefileindex 464766f8..989ccc96 100644--- a/makefile+++ b/makefile@@ -22,11 +22,16 @@ stop: stop-supabase ## stop the stack locallybuild: ## build the appnpm run build-prod-start: build+prod-start: build supabase-deployopen http://127.0.0.1:3000 && npx serve -l tcp://127.0.0.1:3000 dist-prod-deploy: build ## deploy the app to production+prod-deploy: build supabase-deploynpm run ghpages:deploysupabase-remote-init:npm run supabase:remote:init+ $(MAKE) supabase-deploy++supabase-deploy:+ npx supabase db push+ npx supabase functions deploydiff --git a/supabase/config.toml b/supabase/config.tomlindex 1647bb2d..4e1e101d 100644--- a/supabase/config.toml+++ b/supabase/config.toml@@ -1,6 +1,6 @@# A string used to distinguish different Supabase projects on the same host. Defaults to the# working directory name when running `supabase init`.-project_id = "react-admin-crm"+project_id = "atomic-crm-demo"[api]enabled = true