Skip to content

Commit fbdb356

Browse files
committed
docs(api-server): add getting started guide for local setup
- Create new markdown file for API server getting started instructions - Cover prerequisites, cloning repo, configuring environment variables, installing dependencies, and running the development server - Include step-by-step guide with code examples and explanations
1 parent b0584c3 commit fbdb356

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Getting Started (Local Setup)
3+
description: A step-by-step guide to configuring and running the API server on your local machine.
4+
---
5+
6+
import { Steps } from '@astrojs/starlight/components';
7+
8+
This guide will walk you through setting up the API server in a local development environment.
9+
10+
<Steps>
11+
1. **Prerequisites**
12+
13+
Ensure you have the following software installed on your system:
14+
- **Dart SDK:** Version `3.0.0` or higher.
15+
- **MongoDB:** Version `5.0` or higher is recommended.
16+
- **Dart Frog CLI:** Install it globally by running:
17+
```bash
18+
dart pub global activate dart_frog_cli
19+
```
20+
21+
2. **Clone the Repository**
22+
23+
If you haven't already, clone the repository to your local machine.
24+
25+
```bash
26+
git clone https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code.git
27+
cd flutter-news-app-api-server-full-source-code
28+
```
29+
30+
3. **Configure Environment Variables**
31+
32+
The server requires a `.env` file for configuration. Copy the example file to create your own:
33+
34+
```bash
35+
cp .env.example .env
36+
```
37+
38+
Next, open the new `.env` file and update the variables with your local configuration values. At a minimum, you must set the `DATABASE_URL` to point to your local MongoDB instance.
39+
40+
4. **Install Dependencies**
41+
42+
Navigate to the server's root directory and fetch the required Dart packages:
43+
44+
```bash
45+
dart pub get
46+
```
47+
48+
5. **Run the Development Server**
49+
50+
Start the Dart Frog development server:
51+
52+
```bash
53+
dart_frog dev
54+
```
55+
56+
The API will now be running and available at `http://localhost:8080`.
57+
58+
On its first startup, the server will automatically connect to your MongoDB database and seed it with initial data (countries, topics, users, etc.). This seeding process is idempotent, meaning you can safely restart the server multiple times without creating duplicate data.
59+
</Steps>

0 commit comments

Comments
 (0)