Skip to content

Commit a656472

Browse files
committed
Merge branch 'main' into devinxi
2 parents 1f3a606 + fcad0a0 commit a656472

70 files changed

Lines changed: 1514 additions & 2063 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/open-ducks-flash.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/soft-beans-take.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/pnpm-lock.yaml

Lines changed: 268 additions & 560 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/with-auth/.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
SESSION_SECRET = myverylonguniquesecretthatkeepsthingssafe
1+
# Generate using `openssl rand -hex 32`
2+
SESSION_SECRET = myverylongsessionsecretkeythatishouldchange
3+
4+
# Get credentials by creating an application at https://discord.com/developers/applications
25
DISCORD_ID =
36
DISCORD_SECRET =

examples/with-auth/README.md

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,41 @@
1-
# SolidStart
1+
# SolidStart Template
22

3-
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
3+
The **with-auth** example demonstrates native, context-based authentication featuring OAuth and email-password login.
44

5-
## Creating a project
5+
## Installation
66

7-
```bash
8-
# create a new project in the current directory
9-
npm init solid@latest
7+
Generate the **with-auth** template using your preferred package manager
108

11-
# create a new project in my-app
12-
npm init solid@latest my-app
9+
```bash
10+
# using npm
11+
npm create solid@latest -- -s -t with-auth
1312
```
1413

15-
## Developing
16-
17-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
18-
1914
```bash
20-
npm run dev
21-
22-
# or start the server and open the app in a new browser tab
23-
npm run dev -- --open
15+
# using pnpm
16+
pnpm create solid@latest -s -t with-auth
2417
```
2518

26-
## Env Vars
27-
28-
Rename the example file and add your Discord OAuth credentials:
29-
3019
```bash
31-
# rename example environment file
32-
cp .env.example .env
20+
# using bun
21+
bun create solid@latest --s --t with-auth
3322
```
3423

35-
Edit `.env` with your values:
24+
## Configuration
3625

37-
```dotenv
38-
DISCORD_ID=your-discord-client-id
39-
DISCORD_SECRET=your-discord-client-secret
40-
```
26+
1. Rename `.env.example` to `.env`
4127

42-
1. Create an application at [https://discord.com/developers/applications](https://discord.com/developers/applications) to obtain your client ID and secret.
43-
2. In the app's **OAuth2 → Redirects** settings, add:
28+
2. For Discord OAuth2 to work, update `.env` with your credentials:
4429

45-
```text
46-
http://localhost:3000/api/oauth/discord
30+
```dotenv
31+
DISCORD_ID=your-discord-client-id
32+
DISCORD_SECRET=your-discord-client-secret
4733
```
4834

49-
For more details on the [start-oauth](https://github.com/thomasbuilds/start-oauth) integration, see the repository.
50-
51-
## Building
52-
53-
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
35+
- Create a Discord application at [discord.com/developers/applications](https://discord.com/developers/applications) to get your Client ID and Secret.
36+
- In the app's **OAuth2 → URL Generator** or **Redirects** section, add the following redirect URI:
37+
```
38+
http://localhost:3000/api/oauth/discord
39+
```
5440
55-
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.
41+
3. To configure additional providers, refer to the [start-oauth](https://github.com/thomasbuilds/start-oauth#README) documentation

examples/with-auth/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
"build": "vite build"
77
},
88
"dependencies": {
9+
"@solidjs/meta": "^0.29.4",
910
"@solidjs/router": "^0.15.3",
1011
"@solidjs/start": "file:../../packages/start",
11-
"solid-js": "^1.9.7",
12-
"start-oauth": "^1.2.4",
13-
"unstorage": "1.16.1",
12+
"solid-js": "^1.9.9",
13+
"start-oauth": "^1.3.0",
14+
"unstorage": "1.17.1",
1415
"vite": "7.1.3"
1516
},
1617
"devDependencies": {
17-
"@tailwindcss/vite": "^4.1.11",
18-
"tailwindcss": "^4.1.11"
18+
"@tailwindcss/vite": "^4.1.13",
19+
"tailwindcss": "^4.1.13"
1920
},
2021
"engines": {
2122
"node": ">=22"
-664 Bytes
Binary file not shown.
Lines changed: 92 additions & 0 deletions
Loading

examples/with-auth/src/app.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
@import "tailwindcss";
2+
3+
#app {
4+
user-select: none;
5+
}
6+
7+
main {
8+
@apply flex flex-col items-center justify-center min-h-screen bg-gray-50 gap-8 px-4;
9+
}
10+
11+
h1 {
12+
@apply uppercase text-6xl text-sky-700 font-thin;
13+
}
14+
15+
button {
16+
cursor: pointer;
17+
}

examples/with-auth/src/app.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
// @refresh reload
21
import { type RouteDefinition, Router } from "@solidjs/router";
32
import { FileRoutes } from "@solidjs/start/router";
3+
import { MetaProvider } from "@solidjs/meta";
44
import { Suspense } from "solid-js";
5-
import { querySession } from "./lib";
6-
import Session from "./lib/Context";
5+
import { querySession } from "./auth";
6+
import Auth from "./components/Context";
77
import Nav from "./components/Nav";
8+
import ErrorNotification from "./components/Error";
89
import "./app.css";
910

1011
export const route: RouteDefinition = {
@@ -15,12 +16,15 @@ export default function App() {
1516
return (
1617
<Router
1718
root={props => (
18-
<Session>
19-
<Suspense>
20-
<Nav />
21-
{props.children}
22-
</Suspense>
23-
</Session>
19+
<MetaProvider>
20+
<Auth>
21+
<Suspense>
22+
<Nav />
23+
{props.children}
24+
<ErrorNotification />
25+
</Suspense>
26+
</Auth>
27+
</MetaProvider>
2428
)}
2529
>
2630
<FileRoutes />

0 commit comments

Comments
 (0)