diff --git a/.env.example b/.env.example index 047ca3c..6455498 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,29 @@ -RESEND_API_KEY= -NEXT_PUBLIC_API_URL=localhost:8088 -GOOGLE_CLIENT_ID= -GOOGLE_CLIENT_SECRET= +# Rename this file to `.env` and fill in the values. + +# Required variables for basic local functionality + +# For database connection. A 16-character password with digits and letters. SUPABASE_DB_PASSWORD= -POSTHOG_KEY= + +# For authentication. +# Ask the project admin. Should start with "AIza". NEXT_PUBLIC_FIREBASE_API_KEY= + +# The URL where your local backend server is running. +# You can change the port if needed. +NEXT_PUBLIC_API_URL=localhost:8088 + + +# Optional variables for full local functionality + +# For the location / distance filtering features. +# Create a free account at https://rapidapi.com/wirefreethought/api/geodb-cities and get an API key. GEODB_API_KEY= -GOOGLE_APPLICATION_CREDENTIALS_DEV= \ No newline at end of file + +# For analytics like page views, user actions, feature usage, etc. +# Create a free account at https://posthog.com and get a project API key. Should start with "phc_". +POSTHOG_KEY= + +# For sending emails (e.g. for user sign up, password reset, notifications, etc.). +# Create a free account at https://resend.com and get an API key. Should start with "re_". +RESEND_API_KEY= \ No newline at end of file diff --git a/README.md b/README.md index 87368b5..6d7605b 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ # Compass -This repository provides the source code for [Compass](https://compassmeet.com), a web application where people can bond and form deep 1-on-1 relationships in a fully transparent and efficient way. It just got released—please share it with anyone who would benefit from it! +This repository provides the source code for [Compass](https://compassmeet.com), a web application for people to form deep 1-on-1 relationships in a fully transparent and efficient way. And it just got released! -To contribute, please submit a pull request or issue, or fill out this [form](https://forms.gle/tKnXUMAbEreMK6FC6) for suggestions and collaborations. +**We can’t do this alone.** Whatever your skills—coding, design, writing, moderation, marketing, or even small donations—you can make a real difference. [Contribute](https://www.compassmeet.com/about) in any way you can and help our community thrive! ## Features @@ -18,16 +18,17 @@ To contribute, please submit a pull request or issue, or fill out this [form](ht - Open source - Democratically governed -The full description is available [here](https://martinbraquet.com/meeting-rational). +A detailed description of the vision is available [here](https://martinbraquet.com/meeting-rational). ## To Do - [x] Authentication (user/password and Google Sign In) -- [x] Set up PostgreSQL in Production with supabase or prisma console (can stick with SQLite in dev / local) -- [x] Set up hosting (vercel) -- [x] Ask for detailed info per profile upon registration (intellectual interests, location, cause areas, personality type, conflict style, desired type of connection, prompt answers, gender, etc.) +- [x] Set up PostgreSQL in Production with supabase +- [x] Set up web hosting (vercel) +- [x] Set up backend hosting (google cloud) +- [x] Ask for detailed info upon registration (location, desired type of connection, prompt answers, gender, etc.) - [x] Set up page listing all the profiles -- [x] Search through all the profile variables +- [x] Search through most profile variables - [x] (Set up chat / direct messaging) - [x] Set up domain name (https://compassmeet.com) @@ -35,24 +36,26 @@ The full description is available [here](https://martinbraquet.com/meeting-ratio Any action item is open to anyone for collaboration, but the following ones are particularly easy to do for first-time contributors. +- [ ] Add profile features (intellectual interests, cause areas, personality type, conflict style, etc.) +- [ ] Add filters to search through remaining profile features (politics, religion, education level, etc.) +- [ ] Cover with tests (very important, just the test template and framework are ready) - [ ] Clean up terms and conditions - [ ] Clean up privacy notice -- [ ] Clean up learn more page +- [x] Clean up learn more page - [x] Add dark theme -- [ ] Cover with tests (almost nothing is covered right now) ## Implementation -The web app is coded in Typescript using React as front-end and Prisma as back-end. It includes: +The web app is coded in Typescript using React as front-end. It includes: -- [NextAuth.js v4](https://next-auth.js.org/) -- [Prisma Postgres](https://www.prisma.io/postgres) -- [Prisma ORM](https://www.prisma.io/orm) -- Vercel +- [Supabase](https://supabase.com/) for the PostgreSQL database +- [Google Cloud](https://console.cloud.google.com) for hosting the backend API +- [Firebase](https://firebase.google.com/) for authentication and media storage +- [Vercel](https://vercel.com/) for hosting the front-end ## Development -Below are all the steps to contribute. If you have any trouble or questions, please don't hesitate to open an issue or contact us on [Discord](https://discord.gg/8Vd7jzqjun)! +Below are all the steps to contribute. If you have any trouble or questions, please don't hesitate to open an issue or contact us on [Discord](https://discord.gg/8Vd7jzqjun)! We're responsive and happy to help. ### Installation @@ -66,33 +69,30 @@ Install `opentofu`, `docker`, and `yarn`. Try running this on Linux or macOS for ```bash ./setup.sh ``` +If it doesn't work, you can install them manually (Google how to install `opentofu`, `docker`, and `yarn` for your OS). -Install the dependencies: +Then, install the dependencies for this project: ```bash yarn install ``` ### Environment Variables -Configure your database connection via an environment variable. Create an `.env` file: +We can't make the following information public, for security and privacy reasons: +- Database, otherwise anyone could access all the user data (including private messages) +- Firebase, otherwise anyone could remove users or modify the media files +- Email, analytics, and location services, otherwise anyone could use our paid plan + +So, for your development, we will give you user-specific access when possible (e.g., Firebase) and for the rest you will need to set up cloned services (email, locations, etc.) and store your secrets as environment variables. + +To do so, simply create an `.env` file as a copy of `.env.example`, open it, and fill in the variables according to the instructions in the file: ```bash cp .env.example .env ``` -To ensure your authentication works properly, you'll also need to set the `AUTH_SECRET`. You can generate such a random 32-character string with: -```bash -npx auth secret -``` - -In the end, your `.env` file should look similar to this (but using _your own values_ for the secret): -```bash -DATABASE_URL="postgresql://postgres:password@localhost:5432/compass" -AUTH_SECRET="gTwLSXFeNWFRpUTmxlRniOfegXYw445pd0k6JqXd7Ag=" -``` - ### Installing PostgreSQL -Run the following commands to set up your local development database and Prisma schema. Run only the section that corresponds to your operating system. +Run the following commands to set up your local development database. Run only the section that corresponds to your operating system. On macOS: ```bash @@ -120,9 +120,7 @@ ALTER USER postgres WITH PASSWORD 'password'; Create the database ```bash -npx prisma generate -npx prisma db push -npx prisma db seed +... ``` Note that your local database will be made of synthetic data, not real users. This is fine for development and testing. @@ -132,6 +130,7 @@ Make sure the tests pass: ```bash yarn test ``` +TODO: fix tests ### Running the Development Server diff --git a/docs/development.md b/docs/development.md index 3b25cbd..3fe5ed8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -4,21 +4,12 @@ To add a profile variable (personality type, etc.), make modifications here: -* [schema.prisma](../prisma/schema.prisma) -* [seed.ts](../prisma/seed.ts) -* [profile.tsx](../lib/client/profile.tsx) -* [schema.ts](../lib/client/schema.ts) -* [page.tsx](../app/complete-profile/page.tsx) -* [page.tsx](../app/profiles/page.tsx) -* [ProfileFilters.tsx](../app/profiles/ProfileFilters.tsx) -* [route.ts](../app/api/profiles/route.ts) -* [route.ts](../app/api/profiles/%5Bid%5D/route.ts) -* [route.ts](../app/api/user/update-profile/route.ts) +* ... -Then update the database: +Then update the database by running a migration: ```bash -npx prisma migrate dev --name add-some-profile-variable +... ``` ### Cover with tests