What you'll build
1
Create the project
Create a project named CRM. (Or describe it to the AI builder: “A CRM with companies, contacts, deals with stages, and activities”, then adjust.)
2
Create collections and fields
- users
- companies
- contacts
- deals
- activities
3
Add relations
4
Add a login guard
Create a guard on
users with login field email. Turn registration off: you’ll add staff yourself in the dashboard. See Guards.5
Create roles and permissions
6
Add row-level security
- sales_rep on
dealsandactivities: default owner behavior. Reps see records they created. - sales_rep on
companies,contacts,users: allowfield_equalson a field every record has, so reps see the shared directory. - sales_manager: allow policies covering every record, so managers see the whole pipeline.
7
Add a hook
beforeUpdate on deals: stamp the close date when a deal is won or lost. (Add a closed_on Date field first.)8
Build a pipeline report
Report on
deals: dimension stage, metrics count and sum(value). Add a dashboard with stats Open pipeline value and Deals won this month.9
Connect the frontend
Create an See the JavaScript client.
end_users API key with your app’s origin. Reps log in with POST /auth/users/login and load their deals:You have a multi-user CRM backend with validation, access control, business rules, and reporting.
