Skip to content

Commit d074220

Browse files
committed
Add local dev prisma db
1 parent 0ee9437 commit d074220

File tree

3 files changed

+58
-16
lines changed

3 files changed

+58
-16
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ EMAIL_SERVER_PASSWORD=
1616
RESEND_API_KEY=
1717
EMAIL_FROM=
1818

19-
# Development (SQLite)
20-
DATABASE_URL=file:./dev.db
19+
# Development
20+
DATABASE_URL="postgresql://postgres:password@localhost:5432/compass"

README.md

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
[![CD](https://github.com/BayesBond/BayesBond/actions/workflows/cd.yml/badge.svg)](https://github.com/BayesBond/BayesBond/actions/workflows/cd.yml)
44
![Vercel](https://deploy-badge.vercel.app/vercel/bayesbond)
55

6-
# BayesBond
6+
# Compass
77

8-
This repository provides the source code for [BayesBond](https://bayesbond.vercel.app), a web application where rational thinkers can bond and form deep 1-1
8+
This repository provides the source code for [Compass](https://bayesbond.vercel.app), a web application where rational thinkers can bond and form deep 1-1
99
relationships in a fully transparent and efficient way. It just got released—please share it with anyone who would benefit from it!
1010

1111
To contribute, please submit a pull request or issue, or fill out this [form](https://forms.gle/tKnXUMAbEreMK6FC6) for suggestions and collaborations.
@@ -19,7 +19,7 @@ To contribute, please submit a pull request or issue, or fill out this [form](ht
1919
- Open source
2020
- Democratically governed
2121

22-
The full description is available [here](https://BayesBond.com/meeting-rational).
22+
The full description is available [here](https://martinbraquet.com/meeting-rational).
2323

2424
## To Do
2525

@@ -53,48 +53,87 @@ The web app is coded in Typescript using React as front-end and Prisma as back-e
5353

5454
## Development
5555

56-
After cloning the repo and navigating into it, install the dependencies:
56+
Clone the repo and navigating into it:
57+
```bash
58+
git clone [email protected]:BayesBond/BayesBond.git
59+
cd BayesBond
60+
```
5761

62+
Install the dependencies:
5863
```
5964
npm install
6065
```
6166

62-
You now need to configure your database connection via an environment variable.
63-
64-
Create an `.env` file:
67+
### Environment Variables
6568

69+
Configure your database connection via an environment variable. Create an `.env` file:
6670
```bash
6771
cp .env.example .env
6872
```
6973

70-
To ensure your authentication works properly, you'll also need to set the `AUTH_SECRET` [env var for NextAuth.js]
71-
(https://next-auth.js.org/configuration/options). You can generate such a random 32-character string with:
74+
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:
7275
```bash
7376
npx auth secret
7477
```
7578

76-
In the end, your entire `.env` file should look similar to this (but using _your own values_ for the env vars):
79+
In the end, your `.env` file should look similar to this (but using _your own values_ for the secret):
7780
```bash
78-
DATABASE_URL="file:./dev.db"
81+
DATABASE_URL="postgresql://postgres:password@localhost:5432/compass"
7982
AUTH_SECRET="gTwLSXFeNWFRpUTmxlRniOfegXYw445pd0k6JqXd7Ag="
8083
```
8184

82-
Run the following commands to set up your local development database and Prisma schema:
85+
### Installing PostgreSQL
86+
87+
Run the following commands to set up your local development database and Prisma schema. Run only the section that corresponds to your operating system.
88+
89+
On macOS:
90+
```bash
91+
brew install postgresql
92+
brew services start postgresql
93+
```
94+
95+
On Linux:
96+
```bash
97+
sudo apt update
98+
sudo apt install postgresql postgresql-contrib
99+
sudo systemctl start postgresql
100+
````
101+
102+
On Windows, you can download PostgreSQL from the [official website](https://www.postgresql.org/download/windows/).
103+
104+
### Database Initialization
105+
106+
Create a database named `compass` and set the password for the `postgres` user:
107+
```bash
108+
sudo -u postgres psql
109+
ALTER USER postgres WITH PASSWORD 'password';
110+
\q
111+
```
112+
113+
Create the database
83114
```bash
84-
npx prisma migrate dev --name init
115+
npx prisma generate
116+
npx prisma db push
117+
npx prisma db seed
85118
```
86119
Note that your local database will be made of synthetic data, not real users. This is fine for development and testing.
87120

121+
### Tests
122+
88123
Make sure the tests pass:
89124
```bash
90125
npm run test
91126
```
92127

128+
### Running the Development Server
129+
93130
Start the development server:
94131
```bash
95132
npm run dev
96133
```
97134

98-
Once the server is running, visit http://localhost:3000 to start using the app. Now you can start contributing by making changes and submitting pull requests!
135+
Once the server is running, visit http://localhost:3000 to start using the app. You can sign up and visit the profiles; you should see 5 synthetic profiles.
136+
137+
Now you can start contributing by making changes and submitting pull requests!
99138

100139
See [development.md](docs/development.md) for additional instructions, such as adding new profile features.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,8 @@
7171
"tailwindcss": "^3.4.1",
7272
"tsx": "^4.19.2",
7373
"typescript": "^5"
74+
},
75+
"prisma": {
76+
"seed": "npx tsx prisma/seed.ts"
7477
}
7578
}

0 commit comments

Comments
 (0)