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
**Recommended approach**: The easiest way to get started is to use the provided Docker Compose setup, which will start PostgreSQL instantly:
47
+
48
+
```bash
49
+
docker-compose up -d elysia-boilerplate-postgres
50
+
```
51
+
52
+
**Alternative**: If you prefer to run your own PostgreSQL instance, create a database for your project and note the connection details (host, port, database name, username, password). **Remember to update your `.env` file** with the correct `DATABASE_URL` connection string.
47
53
48
54
4.**Create and configure environment variables**
55
+
49
56
```bash
50
57
cp .env.example .env
51
58
```
52
-
59
+
53
60
**Important**: You must create a `.env` file from the provided `.env.example` template and update it with your PostgreSQL connection details:
61
+
54
62
```env
55
63
NODE_ENV=development
56
64
LOG_LEVEL=info
@@ -60,13 +68,15 @@ A modern, production-ready boilerplate for building APIs with Elysia, Bun runtim
60
68
```
61
69
62
70
5.**Run database migrations**
71
+
63
72
```bash
64
73
bun run db:migrate
65
74
```
66
75
67
76
## Development
68
77
69
78
Start the development server with hot reload:
79
+
70
80
```bash
71
81
bun run dev
72
82
```
@@ -94,11 +104,13 @@ This project includes a testing setup using Bun's built-in test runner. Tests ar
94
104
### Running Tests
95
105
96
106
To run all tests:
107
+
97
108
```bash
98
109
bun test
99
110
```
100
111
101
112
To run tests with coverage:
113
+
102
114
```bash
103
115
bun test --coverage
104
116
```
@@ -108,16 +120,17 @@ bun test --coverage
108
120
Add your test files to the `src/tests/` folder. Test files should follow the naming convention `*.test.ts`.
109
121
110
122
Example test structure:
111
-
```
123
+
124
+
```text
112
125
src/tests/
113
-
├── users.test.ts # User module tests
114
-
├── auth.test.ts # Authentication tests
115
-
└── api.test.ts # API endpoint tests
126
+
├── users.test.ts # User module tests
127
+
├── auth.test.ts # Authentication tests
128
+
└── api.test.ts # API endpoint tests
116
129
```
117
130
118
131
## Project Structure
119
132
120
-
```
133
+
```text
121
134
src/
122
135
├── db/ # Database configuration and schema
123
136
│ ├── migrations/ # Database migrations
@@ -160,27 +173,31 @@ The application uses [Envalid](https://github.com/af/envalid) for type-safe envi
160
173
|`LOG_LEVEL`| string |`info`| Logging level |
161
174
|`SERVER_HOSTNAME`| string |`localhost`| Server hostname |
0 commit comments