Skip to content

Commit 956576c

Browse files
committedJul 11, 2024
Updating project
1 parent 5c9c96f commit 956576c

File tree

116 files changed

+3032
-4832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3032
-4832
lines changed
 

‎CONTRIBUTING.md

+6-15
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ Excited to hear that you are interested in contributing to this project! Thank y
88

99
### What is a module?
1010

11-
Modules are a contained group of logic to support a specific feature or domain (i.e., User Module contains authentication, profile, avatars, etc.). They could be as broad or specific as you would like, so long as they contain everything they need to operate independently.
11+
Modules are a contained group of logic to support a specific feature or domain (i.e., Auth Module contains authentication, etc.). They could be as broad or specific as you would like, so long as they contain everything they need to operate independently.
1212

13-
High level modules should only be dependant on low level modules like User. If you create a module that is cross-depandant on multiple modules, you should consider combining these into a single module.
13+
High level modules should only be dependant on low level modules like Auth. If you create a module that is cross-depandant on multiple modules, you should consider combining these into a single module.
1414

1515
Modules are organzied in the `apps/` folder by framework. Each framework folder contains also runnable project along wit the modules source code.
1616

1717
### Module structure
1818

19-
Modules contain async functions (Server Actions) that abstract Supabase database interaction. They are located in `modules` directory and are divided into subdirectories by feature or domain (i.e., `user` module for authentication, profile, avatar, etc.).
19+
Modules contain async functions (Server Actions) that abstract Supabase database interaction. They are located in `database` directory and are divided into subdirectories by feature or domain (i.e., `auth` module for authentication, etc.).
2020

21-
- Each module contains supporting UI components to demo its functionality. These are located in the `components` directory.
22-
- Module component structure should mimic the same structure as their supporting modules (i.e., `modules/user` module component should be located in `components/user` directory).
21+
- Each module contains supporting UI components to demo its functionality. These are located in the `_components` in the demo route.
2322
- The `components/ui` directory only contains general purpose UI elements.
2423

2524
### Components
@@ -42,19 +41,11 @@ The UI parts implement some sort of functionality, many times related to the dat
4241

4342
### Database development
4443

45-
Database development should take place locally using the Supabase Studio or Supabase CLI. After making changes to the DB it is necessary to save perserve them using migrations files. A migration file is a set of SQL commands that will be executed at database reset or init. It usually incorporates creation of the tables, setting security, creating custom functions and triggers, etc. Migration files are stored in the given framework project in the directory `supabase/migrations` are prefixed with the timestamp, for example: `20240214100236_user.sql`.
44+
Database development should take place locally using the Supabase Studio or Supabase CLI. After making changes to the DB it is necessary to save perserve them using migrations files. A migration file is a set of SQL commands that will be executed at database reset or init. It usually incorporates creation of the tables, setting security, creating custom functions and triggers, etc. Migration files are stored in the given framework project in the directory `supabase/migrations` are prefixed with the timestamp, for example: `20240214100236_profiles.sql`.
4645

4746
#### Save changes made to the database
4847

49-
New changes to database can be stored using diffing. After making changes locally using for example Studio we now need to store new changes. The Supabase CLI command [`supabase db diff`](https://supabase.com/docs/reference/cli/supabase-db-diff) can be used for this:
50-
51-
```shell
52-
supabase db diff --schema auth,public --use-migra user -f user
53-
```
54-
55-
The above code will create a new migration file containing the new changes (that are not included in the previous migration files) with the "user" postfix in the `migrations` folder.
56-
57-
Due to modularity goals of this project, we also want to keep migrations file in the squashed format for given module. For example, in the `modules/user` there is an `migrations.sql` that contains all the SQL code that should be applied to the DB when extracting only the user module to the target project. Currently there is not known Supabase CLI command that can create squashed migration file on table level, so this needs to be maintained manually every time new migrations for the given module are added to the `supabase/migrations` folder.
48+
New changes to database can be stored using diffing. After making changes locally using for example Studio we now need to store new changes. The Supabase CLI command [`supabase db diff`](https://supabase.com/docs/reference/cli/supabase-db-diff) can be used for this.
5849

5950
#### Testing migration changes
6051

‎README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ For example, our [Next.js](https://nextjs.org/) app looks like this:
1717
📂 docs
1818
📂 apps
1919
📂 next
20-
📁 components
21-
📁 user
22-
📁 modules
23-
📁 user
20+
📁 database
21+
📁 client
2422
📁 types
2523
📁 utils
2624
📁 supabase
2725
📁 migrations
2826
```
2927

30-
- The UI lives in the `/components` directory categorized by module name i.e. _user_.
31-
- The logic lives in the `/modules` directory categorized by module name i.e. _user_.
32-
- The database configuration lives in the `/supabase` directory where migrations can be identified by module name i.e. _20240214100236_user.sql_.
28+
- The UI lives colocated in the route's `_components` directory that belongs to the module demo'd.
29+
- The logic lives in the `/database` directory categorized by module name.
30+
- The database configuration lives in the `/supabase` directory where migrations can be identified by module name i.e. _profiles.sql_.
3331

3432
## Requirements
3533

0 commit comments

Comments
 (0)
Please sign in to comment.