Appwrite
31SaaS integrates with Appwrite for database management and authentication. This document outlines the setup process and configuration required to get the boilerplate running.
Integrating with Appwrite
- If you haven’t already, sign up for an Appwrite account.
- Create a project and database within Appwrite.
- Retrieve your project ID and set it as the environment variables
APPWRITE_PROJECT_IDandNEXT_PUBLIC_APPWRITE_PROJECT_ID. - Generate an API key and set it as the environment variable
APPWRITE_API_KEY. - Set your Appwrite endpoint URL as the environment variables
APPWRITE_ENDPOINTandNEXT_PUBLIC_APPWRITE_ENDPOINT. - Configure two web app platforms in Appwrite: one for local development (set hostname as
localhost) and one for production (set hostname as your production URL). The latter can be set up later when you are ready to go live.
Database Collections
In your database, create these collections:
user
Stores user data and associated Stripe information.
Attribute
| Attribute | Type | Required | Max Char | Default Value |
|---|---|---|---|---|
| stripeCustomerId | String | 50 | ||
| stripeSubscriptionId | String | 50 | ||
| Yes | ||||
| stripePlanQuantity | Int | 0 | ||
| stripeSubscriptionStatus | String | 50 | ||
| stripePriceId | String | 50 | ||
| createdAt | Date | Yes | ||
| stripeCurrentPeriodEnd | Date |
Permission
Document security = enabled.
Grant any to create.
Index
| Key | Type | Attributes | Asc/Desc |
|---|---|---|---|
| stripeCustomerId | key | stripeCustomerId | Asc |
task
Stores demo dashboard data.
Attribute
| Attribute | Type | Required | Max Char | Default Value |
|---|---|---|---|---|
| title | String | Yes | 175 | |
| content | String | 5000 | ||
| createdAt | Date | Yes | ||
| status | Enum | pending |
Use pending, wip, started, canceled as the status.
Permission
Document security = disabled.
Grant any to create, read, update, delete.
subscriber
Stores subscriber emails from your landing page.
Attribute
| Attribute | Type | Required | Max Char | Default Value |
|---|---|---|---|---|
| Yes |
Permission
Document security = disabled.
Grant any to create.