You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+44-24Lines changed: 44 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,59 +42,79 @@ To use GitHub authentication in the project, you need to create a GitHub OAuth a
42
42
6. On the next page, you'll see your Client ID. Click "Generate a new client secret" to create your Client Secret.
43
43
7. Copy the Client ID and Client Secret to your `.env.local` file.
44
44
45
-
## Setting Up Xata
45
+
## Setting Up the Database
46
46
47
-
Xata is used as the database for this project. Follow these steps to set it up:
47
+
This project uses PostgreSQL as the database. You have several options for setting up the database:
48
48
49
-
1. Sign up for a Xata account at https://lite.xata.io/
50
-
2. Create a new workspace and database from Xata dashboard
51
-
3. Install the Xata CLI globally:
49
+
### Option 1: Docker Compose (Recommended)
52
50
53
-
```sh
54
-
npm install -g "@xata.io/cli@latest"
55
-
```
51
+
The easiest way to get started is using Docker Compose, which will set up a PostgreSQL database with simple credentials:
56
52
57
-
4. Authenticate with Xata:
53
+
1. Start the PostgreSQL database:
58
54
59
55
```sh
60
-
xata auth login
56
+
docker compose up -d
61
57
```
62
58
63
-
5. Initialize the database:
59
+
> Use `docker-compose` if you are on an older version of Docker and the above command does not work.
64
60
65
-
```sh
66
-
xata init
67
-
```
61
+
2. Wait for the database to be ready (you can check with `docker compose ps`)
68
62
69
-
5. Upload the database schema:
63
+
3. Run database migrations:
70
64
71
65
```sh
72
-
xata schema upload db-schema.json
66
+
pnpm drizzle-kit migrate
73
67
```
74
68
75
-
6. Generate the Xata client:
69
+
The database will be available at `localhost:5432` with these credentials:
76
70
77
-
```sh
78
-
xata codegen
79
-
```
71
+
- Database: `hacktoberfest`
72
+
- Username: `hacktoberfest`
73
+
- Password: `hacktoberfest123`
74
+
75
+
### Option 2: Local PostgreSQL Installation
76
+
77
+
If you prefer to install PostgreSQL locally:
78
+
79
+
1. Install PostgreSQL on your system
80
+
2. Create a database named `hacktoberfest`
81
+
3. Create a user `hacktoberfest` with password `hacktoberfest123`
82
+
4. Grant all privileges on the database to the user
83
+
84
+
### Option 3: Cloud Database Providers
85
+
86
+
You can also use cloud database providers like:
87
+
88
+
-**Neon** (https://neon.tech/) - Free tier available
89
+
-**Supabase** (https://supabase.com/) - Free tier available
90
+
-**Railway** (https://railway.app/) - Free tier available
91
+
-**PlanetScale** (https://planetscale.com/) - Free tier available
92
+
93
+
Simply create a PostgreSQL database and copy the connection string.
80
94
81
95
## Environment Variables
82
96
83
-
Create a `.env.local` file in the root of the project and add the following variables:
97
+
Create a `.env` file in the root of the project and add the following variables:
84
98
85
99
```sh
100
+
# Database
101
+
DATABASE_URL=""# PostgreSQL connection string
102
+
# For Docker Compose: postgresql://hacktoberfest:hacktoberfest123@localhost:5432/hacktoberfest
103
+
# For cloud providers: copy the connection string from your provider
104
+
105
+
# Authentication
86
106
AUTH_SECRET=""# A random string
87
107
AUTH_URL=""# Should be http://localhost:3000 for local development
88
108
AUTH_GITHUB_ID=""
89
109
AUTH_GITHUB_SECRET=""
90
-
XATA_API_KEY=""
91
-
XATA_BRANCH=""# Default should be "main"
110
+
AUTH_DRIZZLE_URL="$DATABASE_URL"# Should be the same as DATABASE_URL
92
111
112
+
# Optional
93
113
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=""# Optional
94
114
NEXT_PUBLIC_ANALYTICS_WEBSITE_ID=""# Optional
95
115
```
96
116
97
-
Make sure to fill in the required values for each variable. The `AUTH_SECRET` should be a random string, and `AUTH_URL` should be set to `http://localhost:3000` for local development. The `XATA_BRANCH` should typically be set to "main" unless you're using a different branch.
117
+
Make sure to fill in the required values for each variable. The `AUTH_SECRET` should be a random string, and `AUTH_URL` should be set to `http://localhost:3000` for local development. The `DATABASE_URL` should point to your PostgreSQL database.
98
118
99
119
Remember to remove env variables that are optional and you are empty, they will cause validation errors
0 commit comments