Skip to content

Commit 68a2fb5

Browse files
committed
docs: update README with postgresql setup instructions
Enhances the README.md to reflect the new PostgreSQL database requirement. - Adds PostgreSQL to the prerequisites. - Adds a new "Configuration" section explaining the `DATABASE_URL` environment variable. - Updates the "Run the development server" description to remove references to in-memory repositories and mention the new database seeding process.
1 parent 745ab9d commit 68a2fb5

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,38 @@ for more details.
6666

6767
1. **Prerequisites:**
6868
* Dart SDK (`>=3.0.0`)
69+
* PostgreSQL (`>=14.0` recommended)
6970
* Dart Frog CLI (`dart pub global activate dart_frog_cli`)
70-
2. **Clone the repository:**
71+
72+
2. **Configuration:**
73+
Before running the server, you must configure the database connection by
74+
setting the `DATABASE_URL` environment variable.
75+
76+
Create a `.env` file in the root of the project or export the variable in
77+
your shell:
78+
```
79+
DATABASE_URL="postgres://user:password@localhost:5432/ht_api_db"
80+
```
81+
82+
3. **Clone the repository:**
7183
```bash
7284
git clone https://github.com/headlines-toolkit/ht-api.git
7385
cd ht-api
7486
```
75-
3. **Get dependencies:**
87+
4. **Get dependencies:**
7688
```bash
7789
dart pub get
7890
```
79-
4. **Run the development server:**
91+
5. **Run the development server:**
8092
```bash
8193
dart_frog dev
8294
```
83-
The API will typically be available at `http://localhost:8080`. Fixture data
84-
from `lib/src/fixtures/` will be loaded into the in-memory repositories on
85-
startup.
95+
The API will typically be available at `http://localhost:8080`. On the
96+
first startup, the server will connect to your PostgreSQL database, create the
97+
necessary tables, and seed them with initial fixture data. This process is
98+
non-destructive; it uses `CREATE TABLE IF NOT EXISTS` and `INSERT ... ON
99+
CONFLICT DO NOTHING` to avoid overwriting existing tables or data.
100+
86101
87102
**Note on Web Client Integration (CORS):**
88103
To allow web applications (like the HT Dashboard) to connect to this API,

0 commit comments

Comments
 (0)