-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Reviewing Open Saas code #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sodic
wants to merge
2
commits into
filip-empty
Choose a base branch
from
filip-code-review
base: filip-empty
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# <YOUR_APP_NAME> | ||
|
||
This project is based on [OpenSaas](https://opensaas.sh) template and consists of three main dirs: | ||
1. `app` - Your web app, built with [Wasp](https://wasp.sh). | ||
2. `e2e-tests` - [Playwright](https://playwright.dev/) tests for your Wasp web app. | ||
3. `blog` - Your blog / docs, built with [Astro](https://docs.astro.build) based on [Starlight](https://starlight.astro.build/) template. | ||
|
||
For more details, check READMEs of each respective directory! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Wasp Import Rules | ||
- Path to Wasp functions within .ts files must come from 'wasp', not '@wasp'! | ||
✓ import { Task } from 'wasp/entities' | ||
✓ import type { GetTasks } from 'wasp/server/operations' | ||
✓ import { getTasks, useQuery } from 'wasp/client/operations' | ||
✗ import { getTasks, useQuery } from '@wasp/...' | ||
✗ import { getTasks, useQuery } from '@src/feature/operations.ts' | ||
|
||
- Path to external imports within 'main.wasp' must start with "@src/"! | ||
✓ component: import { LoginPage } from "@src/client/pages/auth/LoginPage.tsx" | ||
✗ component: import { LoginPage } from "@client/pages/auth/LoginPage.tsx" | ||
- In the client's root component, use the Outlet component rather than children | ||
✓ import { Outlet } from 'react-router-dom'; | ||
|
||
// Wasp DB Schema Rules | ||
- Add databse models to the 'schema.prisma' file, NOT to 'main.wasp' as "entities" | ||
- Do NOT add a db.system nor a db.prisma property to 'main.wasp'. This is taken care of in 'schema.prisma' | ||
- Keep the 'schema.prisma' within the root of the project | ||
|
||
// Wasp Operations | ||
- Types are generated automatically from the function definition in 'main.wasp', | ||
✓ import type { GetTimeLogs, CreateTimeLog, UpdateTimeLog } from 'wasp/server/operations' | ||
- Wasp also generates entity types based on the models in 'schema.prisma' | ||
✓ import type { Project, TimeLog } from 'wasp/entities' | ||
- Make sure that all Entities that should be included in the operations context are defined in its definition in 'main.wasp' | ||
✓ action createTimeLog { fn: import { createTimeLog } from "@src/server/timeLogs/operations.js", entities: [TimeLog, Project] } | ||
|
||
// Wasp Auth | ||
- When creating Auth pages, use the LoginForm and SignupForm components provided by Wasp | ||
✓ import { LoginForm } from 'wasp/client/auth' | ||
- Wasp takes care of creating the user's auth model id, username, and password for a user, so a user model DOES NOT need these properties | ||
✓ model User { id Int @id @default(autoincrement()) } | ||
|
||
// Wasp Dependencies | ||
- Do NOT add dependencies to 'main.wasp' | ||
- Install dependencies via 'npm install' instead | ||
|
||
// Wasp | ||
- Use the latest Wasp version, ^0.16.0 | ||
- Always use typescript for Wasp code. | ||
- When creating Wasp operations (queries and actions) combine them into an operations.ts file within the feature directory rather than into separate queries.ts and actions.ts files | ||
|
||
// React | ||
- Use relative imports for other react components | ||
- If importing a function from an operations file, defer to the wasp import rules | ||
|
||
// CSS | ||
- Use Tailwind CSS for styling. | ||
- Do not use inline styles unless necessary | ||
|
||
// General | ||
- Use single quotes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# All client-side env vars must start with REACT_APP_ https://wasp.sh/docs/project/env-vars | ||
|
||
# See https://docs.opensaas.sh/guides/analytics/#google-analytics | ||
REACT_APP_GOOGLE_ANALYTICS_ID=G-... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# NOTE: you can let Wasp set up your Postgres DB by running `wasp start db` in a separate terminal window. | ||
# then, in a new terminal window, run `wasp db migrate-dev` and finally `wasp start`. | ||
# If you use `wasp start db` then you DO NOT need to add a DATABASE_URL env variable here. | ||
# DATABASE_URL= | ||
|
||
# For testing, go to https://dashboard.stripe.com/test/apikeys and get a test stripe key that starts with "sk_test_..." | ||
STRIPE_API_KEY=sk_test_... | ||
# After downloading starting the stripe cli (https://stripe.com/docs/stripe-cli) with `stripe listen --forward-to localhost:3001/payments-webhook` it will output your signing secret | ||
STRIPE_WEBHOOK_SECRET=whsec_... | ||
# You can find your Stripe customer portal URL in the Stripe Dashboard under the 'Customer Portal' settings. | ||
STRIPE_CUSTOMER_PORTAL_URL=https://billing.stripe.com/... | ||
|
||
# For testing, create a new store in test mode on https://lemonsqueezy.com | ||
LEMONSQUEEZY_API_KEY=eyJ... | ||
# After creating a store, you can find your store id in the store settings https://app.lemonsqueezy.com/settings/stores | ||
LEMONSQUEEZY_STORE_ID=012345 | ||
# define your own webhook secret when creating a new webhook on https://app.lemonsqueezy.com/settings/webhooks | ||
LEMONSQUEEZY_WEBHOOK_SECRET=my-webhook-secret | ||
|
||
# If using Stripe, go to https://dashboard.stripe.com/test/products and click on + Add Product | ||
# If using Lemon Squeezy, go to https://app.lemonsqueezy.com/products and create new products and variants | ||
PAYMENTS_HOBBY_SUBSCRIPTION_PLAN_ID=012345 | ||
PAYMENTS_PRO_SUBSCRIPTION_PLAN_ID=012345 | ||
PAYMENTS_CREDITS_10_PLAN_ID=012345 | ||
|
||
# set this as a comma-separated list of emails you want to give admin privileges to upon registeration | ||
ADMIN_EMAILS=me@example.com,you@example.com,them@example.com | ||
|
||
# see our guide for setting up google auth: https://wasp.sh/docs/auth/social-auth/google | ||
GOOGLE_CLIENT_ID=722... | ||
GOOGLE_CLIENT_SECRET=GOC... | ||
|
||
# get your sendgrid api key at https://app.sendgrid.com/settings/api_keys | ||
SENDGRID_API_KEY=test... | ||
|
||
# (OPTIONAL) get your openai api key at https://platform.openai.com/account | ||
OPENAI_API_KEY=sk-k... | ||
|
||
# (OPTIONAL) get your plausible api key at https://plausible.io/login or https://your-plausible-instance.com/login | ||
PLAUSIBLE_API_KEY=gUTgtB... | ||
# You will find your site id in the Plausible dashboard. It will look like 'opensaas.sh' | ||
PLAUSIBLE_SITE_ID=yoursite.com | ||
PLAUSIBLE_BASE_URL=https://plausible.io/api # if you are self-hosting plausible, change this to your plausible instance's base url | ||
|
||
# (OPTIONAL) get your google service account key at https://console.cloud.google.com/iam-admin/serviceaccounts | ||
GOOGLE_ANALYTICS_CLIENT_EMAIL=email@example.gserviceaccount.com | ||
# Make sure you convert the private key within the JSON file to base64 first with `echo -n "PRIVATE_KEY" | base64`. see the docs for more info. | ||
GOOGLE_ANALYTICS_PRIVATE_KEY=LS02... | ||
# You will find your Property ID in the Google Analytics dashboard. It will look like '987654321' | ||
GOOGLE_ANALYTICS_PROPERTY_ID=123456789 | ||
|
||
# (OPTIONAL) get your aws s3 credentials at https://console.aws.amazon.com and create a new IAM user with S3 access | ||
AWS_S3_IAM_ACCESS_KEY=ACK... | ||
AWS_S3_IAM_SECRET_KEY=t+33a... | ||
AWS_S3_FILES_BUCKET=your-bucket-name | ||
AWS_S3_REGION=your-region |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.wasp/ | ||
node_modules/ | ||
|
||
# Ignore all dotenv files by default to prevent accidentally committing any secrets. | ||
# To include specific dotenv files, use the `!` operator or adjust these rules. | ||
.env | ||
.env.* | ||
|
||
# Don't ignore example dotenv files. | ||
!.env.example | ||
!.env.*.example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore editor tmp files | ||
**/*~ | ||
**/#*# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
File marking the root of Wasp project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# <YOUR_APP_NAME> | ||
|
||
Built with [Wasp](https://wasp.sh), based on the [Open Saas](https://opensaas.sh) template. | ||
|
||
## Development | ||
|
||
### Running locally | ||
- Make sure you have the `.env.client` and `.env.server` files with correct dev values in the root of the project. | ||
- Run the database with `wasp start db` and leave it running. | ||
- Run `wasp start` and leave it running. | ||
- [OPTIONAL]: If this is the first time starting the app, or you've just made changes to your entities/prisma schema, also run `wasp db migrate-dev`. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional is probably not the right word here, since it's mandatory when it's mandatory, and has no effect otherwise.