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
If you forked this repository before May 27th, you'll want to view commit `653e2c2`. There was an issue with the Hono context
6
-
not correctly parsing routes.
5
+
If you forked this repository before May 27th, you'll want to view commit `653e2c2`. There was an issue with the Hono context not correctly parsing routes.
7
6
8
7
## ❔ What
9
8
10
-
A scalable, testable, extensible, boilerplate for Sveltekit.
9
+
A scalable, testable, extensible, template for Sveltekit.
11
10
12
-
Sveltekit is awesome. File-based routing, SSG/SSR, and having the ability to have a backend attatched to your frontend saves incredible amounts of time and effort.
11
+
Sveltekit is awesome, but sometimes you need a bit more capability in the backend than what frameworks like
12
+
NextJS & Sveltekit can deliver.
13
13
14
-
But the default backend sometimes isn't enough. There are some projects that require more powerful and feature rich backends. I'm talking Middleware, guards, pipes, interceptors, testing, event-emitters, task scheduling, route versioning, and so on.
15
-
16
-
So what I've done is attatched Hono, a fully fletched backend, to run on the Sveltekit process and forward all API requests to it.
14
+
To remedy this, I've attatched a fully fletched backend to run on the Sveltekit process and forward all API requests to it and paired it with some architectural patterns.
This is **not** supposed to serve as an all batteries included ["production boilerplate"](https://github.com/ixartz/Next-js-Boilerplate) with 200 useless sponsored features that get in your way. Templates that do this are ANYTHING but "production" and "quick start".
31
+
32
+
This is stack is designed to be library agnostic. The philosophy here is to boostrap the concrete, repetitive, and time consuming tasks that every application will need reguardless of what you're building.
33
+
34
+
So, fork this repo, add your favorite libraries, and make it your own "more opinionated" personal template **tailored to you**!
35
+
30
36
## Features
31
37
32
38
- 🟢 Full E2E typesafety
33
39
- 🟢 RPC Client for API Requests
34
40
- 🟢 Custom Fetch Wrapper
35
41
- 🔴 Deployment Template
36
42
- 🟠 Authentication
37
-
- 🟢 Email/Passkey
38
-
- 🔴 OAuth
43
+
- 🟢 Email/Passkey
44
+
- 🔴 OAuth
39
45
- 🟢 Email Update/Verifiaction
40
-
46
+
- 🔴 Rate limiter
41
47
42
48
## Technologies
43
49
50
+
I'm mostly unopinionated or what technology or libaries someone uses. Wanna [uwu'ify](https://www.npmjs.com/package/owoifyx) your entire fucking app? Go for it.
51
+
52
+
That being said, there are some libaries that embody my philosophies of building software more than others,
53
+
44
54
-[Lucia](https://lucia-auth.com): Hits the right level of abstraction for me. Hand me the tools to build a secure authentication system and let me implement it to suite my needs
45
55
-[Drizzle](https://orm.drizzle.team/) - Drizzle advertises itself as an ORM but I think its deceptive. Its a query builder with a migration client. Everytime I've used an ORM, I find myself fighting it for sometimes the simplist of use cases. Drizzle just gives you type-safety while querying SQL in a native fashion. Learn SQL, not ORMs.
46
-
-[Hono](https://hono.dev/): Fast, lightweight, and built on web standards; meaning it can run anywhere you're Sveltekit app can. It's essentially a better, newer, and ironically more stable Express.JS. This provides us an extreemely good foundation to cleanly build ontop of without having to teardown first. It has a zod adapter for validating DTO's which can be shared with the frontend too.
47
-
-[Sveltekit](https://kit.svelte.dev/): After trying Vue, React, Next, and pretty much every frotnend framework in the JS ecosystem, its safe to say I vastly prefer Svelte and its priority of building on web standards.
56
+
-[Hono](https://hono.dev/): Fast, lightweight, and built on **web standards**; meaning it can run anywhere you're Sveltekit app can. It's essentially a better, newer, and ironically more stable Express.JS. This provides us an extreemely good foundation to cleanly build ontop of without having to teardown first. It has a zod adapter for validating DTO's which can be shared with the frontend too.
57
+
-[Sveltekit](https://kit.svelte.dev/): After trying Vue, React, Next, and pretty much every frotnend framework in the JS ecosystem, its safe to say I vastly prefer Svelte and its priority of building on **web standards**.
48
58
49
59
## Architecture
50
60
51
-
There are a few popular architectures for structuring backends. Technical, Onion, VSA, and the list goes on. I almost always choose
52
-
to start with Technical and let the project naturally evolve into one of the others.
53
-
54
-
### Folder Structure
55
-
***controllers** - Responsible for routing requests
61
+
There are a few popular architectures for structuring backends. Technical, Onion, DDD, VSA, and the list goes on. I almost always choose
62
+
to start with Technical and let the project naturally evolve into one of the others as complexity grows.
56
63
57
-
***services** - Responsible for handling business logic.
64
+
### Backend Folder Structure
58
65
59
-
***repositories** - Responsible for retrieving and
60
-
storing data.
66
+
-**controllers** - Responsible for routing requests
61
67
62
-
***infrastructure** - Handles the implementation of external services or backend operations.
68
+
-**services** - Responsible for handling business logic.
63
69
64
-
***interfaces** - Common
70
+
-**repositories** - Responsible for retrieving and
71
+
storing data.
65
72
66
-
***middleware** - Middlware our request router is responsible for handling.
73
+
-**infrastructure**- Handles the implementation of external services or backend operations.
67
74
68
-
***providers** - Injectable services
75
+
-**middleware** - Middlware our request router is responsible for handling.
69
76
70
-
***dtos** - Data Transfer Objects (DTOs) are used to define the shape of data that is passed.
77
+
-**providers** - Injectable services
71
78
72
-
***common** - Anything commonly shared throughout the backend
79
+
-**dtos** - Data Transfer Objects (DTOs) are used to define the shape of data that is passed.
73
80
81
+
-**common** - Anything commonly shared throughout the backend
74
82
75
83
### File Naming
84
+
76
85
You might notice how each file in the backend is postfixed with its architectural type(e.g. `iam.service.ts`). This allows
77
-
us to easily reorganize the folder structure to suite a different architecture.
86
+
us to easily reorganize the folder structure to suite a different architecture pattern if the domain becomes more complex.
78
87
79
88
For example, if you want to group folders by domain(DDD), you simply drag and drop all related files to that folder.
89
+
80
90
```
81
91
└── events/
82
92
├── events.controller.ts
83
93
├── events.service.ts
84
94
└── events.repository.ts
85
95
```
86
96
87
-
88
97
## Testing
89
98
90
-
Testing probably isn't first and foremost when creating an app. Thats fine. You shouldnt't be spending time writing tests if your app is changing and pivoting.
99
+
Testing probably isn't first and foremost when creating an app. Thats fine. You should not be spending time writing tests if your app is mutable.
91
100
92
-
BUT a good stack should be **testable** when the time to solidify a codebase arrives. I created this stack with that pinciple in mind. I've provided a examples of how to write these tests under `authentication.service.test.ts` or `users.service.test.ts`
101
+
BUT, a good stack should be **testable** when the time to solidify a codebase arrives. I created this stack with that pinciple in mind. I've provided a examples of how to write these tests under `authentication.service.test.ts` or `users.service.test.ts`
0 commit comments