## Contents - [Lead Mappa core](#lead-mappa-core) - [Contents](#contents) - [What's this repo for?](#whats-this-repo-for) - [How do I get going?](#how-do-i-get-going) - [What about the frontend?](#what-about-the-frontend) - [What's the code styl
---
Code is organised around core elements (Domains). For example, a lead, a user, or a job. Each domain contains "adapters" that perform a single task, such as "update profile" or "assign lead".
There are no controllers. Just adapters that attempt to follow the Clean Architecture code style.
---
To get going do the following:
The following will spin up a dockerised version of the database
- Local Supabase[Postgresql setup]
- Install Docker
- Install Supabase cli globally
- ``cd supabase ``
- supabase start``
- supabase reset` will undo any changes not captured in migration
The following will download and install the dependencies and then start the test watchers.
- Source code setup
- `npm install``
- npm run dev`
> ❗🙀 Please note that when Supabase starts for the first time, it will provide keys that need to be placed in the appropriate env files. Subsequent start and stop commands will not change the keys. However, upgrading Supabase or asking Docker to download again will renew the keys.
---
If you use "supabase-integration/supabase" as the directory name it will automatically be ignored by Git. You can then `cd supabase-integration/supabase` and run `supabase start`. Anything done in that folder will not be committed. So you can configure it differently to suit the frontend:
- config.toml: Change the port numbers (a must)
- config.toml: Change the project-id to "supabase-integration" (a must)
- seed.sql: Add whatever data is required to start
---
Conventional commits are being used, and a linter is in place, which is triggered by commit hooks, so please follow that, or your commits will be rejected by the linter.
---
npm run build` to test the code and compile everything
- Commit this build to git
- `npm run release:[patch|minor|major]` to tag, create a release and publish to NPM.---
How can I actually use the package?
The test files are a good place to start to understand how the package can be used. As well as this, each domain should have a README file detailing how it's used. The basic pattern of use is shown below
`javascript npm install @scopethis/lead-core
...
// commonjs
const container = require('@scopethis/lead-core').default
const result = container('DomainAdapter', data)
// ES6 - NOT PUBLISHED. Only used in this repo
import container from '../../src'
const result = await container('DomainAdapter', data)
// Where 'DomainAdpater' is the resolved functionality
// And data is the structured option passed to it
``