Skip to content

Commit 4d73eb0

Browse files
committed
chore: init
0 parents  commit 4d73eb0

11 files changed

+219
-0
lines changed

Diff for: .env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NUXT_PUBLIC_HELLO_TEXT="Hello from the Edge 👋"

Diff for: .gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

Diff for: README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Hello Edge
2+
3+
A minimal [Nuxt](https://nuxt.com) starter deployed on the Edge using [NuxtHub](https://hub.nuxt.com).
4+
5+
## Features
6+
7+
- Server-Side rendering on Cloudflare Workers
8+
- ESLint setup
9+
- Ready to add a database, blob and KV storage
10+
11+
## Setup
12+
13+
Make sure to install the dependencies:
14+
15+
```bash
16+
# npm
17+
npm install
18+
19+
# pnpm
20+
pnpm install
21+
22+
# yarn
23+
yarn install
24+
25+
# bun
26+
bun install
27+
```
28+
29+
You can update the main text displayed by creating a `.env`:
30+
31+
```bash
32+
NUXT_PUBLIC_HELLO_TEXT="Hello my world!"
33+
```
34+
35+
## Development Server
36+
37+
Start the development server on `http://localhost:3000`:
38+
39+
```bash
40+
# npm
41+
npm run dev
42+
43+
# pnpm
44+
pnpm run dev
45+
46+
# yarn
47+
yarn dev
48+
49+
# bun
50+
bun run dev
51+
```
52+
53+
## Production
54+
55+
Build the application for production:
56+
57+
```bash
58+
# npm
59+
npm run build
60+
61+
# pnpm
62+
pnpm run build
63+
64+
# yarn
65+
yarn build
66+
67+
# bun
68+
bun run build
69+
```
70+
71+
## Deploy
72+
73+
74+
Deploy the application on the Edge with [NuxtHub](https://hub.nuxt.com) on your Cloudflare account:
75+
76+
```bash
77+
npx nuxthub deploy
78+
```
79+
80+
Then checkout your server logs, analaytics and more in the [NuxtHub Admin](https://admin.hub.nuxt.com).
81+
82+
You can also deploy using [Cloudflare Pages CI](https://hub.nuxt.com/docs/getting-started/deploy#cloudflare-pages-ci).
83+

Diff for: app/app.vue

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<NuxtRouteAnnouncer />
3+
<NuxtLoadingIndicator />
4+
<NuxtPage />
5+
</template>

Diff for: app/pages/index.vue

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script setup>
2+
const runtimeConfig = useRuntimeConfig()
3+
const colors = ['#f87171', '#fb923c', '#fbbf24', '#facc15', '#a3e635', '#4ade80', '#34d399', '#2dd4bf', '#22d3ee', '#38bdf8', '#60a5fa', '#818cf8', '#a78bfa', '#c084fc', '#e879f9', '#f472b6', '#fb7185']
4+
const color = useState('color', () => colors[Math.floor(Math.random() * colors.length)])
5+
</script>
6+
7+
<template>
8+
<div class="centered">
9+
<h1 :style="{ color }">{{ runtimeConfig.public.helloText }}</h1>
10+
<NuxtLink to="/" external>refresh</NuxtLink>
11+
</div>
12+
</template>
13+
14+
<style scoped>
15+
.centered {
16+
position: absolute;
17+
width: 100%;
18+
text-align: center;
19+
top: 50%;
20+
left: 50%;
21+
transform: translate(-50%, -50%);
22+
margin: 0;
23+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
24+
}
25+
h1 {
26+
font-size: 32px;
27+
}
28+
@media (min-width: 768px) {
29+
h1 {
30+
font-size: 64px;
31+
}
32+
}
33+
a {
34+
color: #888;
35+
text-decoration: none;
36+
font-size: 18px;
37+
}
38+
a:hover {
39+
text-decoration: underline;
40+
}
41+
</style>

Diff for: eslint.config.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-check
2+
import withNuxt from './.nuxt/eslint.config.mjs'
3+
4+
export default withNuxt(
5+
// Your custom configs here
6+
)

Diff for: nuxt.config.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
// https://nuxt.com/docs/getting-started/upgrade#testing-nuxt-4
4+
future: { compatibilityVersion: 4 },
5+
6+
// https://nuxt.com/modules
7+
modules: [
8+
'@nuxthub/core',
9+
'@nuxt/eslint'
10+
],
11+
12+
// https://hub.nuxt.com/docs/getting-started/installation#options
13+
hub: {},
14+
15+
// Env variables - https://nuxt.com/docs/getting-started/configuration#environment-variables-and-private-tokens
16+
runtimeConfig: {
17+
public: {
18+
// Can be overridden by NUXT_PUBLIC_HELLO_TEXT environment variable
19+
helloText: 'Hello from the Edge 👋'
20+
}
21+
},
22+
23+
24+
// https://devtools.nuxt.com
25+
devtools: { enabled: true }
26+
})

Diff for: package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "nuxt-app",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "nuxt build",
7+
"dev": "nuxt dev",
8+
"generate": "nuxt generate",
9+
"preview": "nuxt preview",
10+
"postinstall": "nuxt prepare",
11+
"lint": "eslint ."
12+
},
13+
"dependencies": {
14+
"@nuxt/eslint": "^0.3.13",
15+
"@nuxthub/core": "^0.6.15",
16+
"nuxt": "^3.12.1",
17+
"vue": "^3.4.27",
18+
"vue-router": "^4.3.3"
19+
},
20+
"devDependencies": {
21+
"@nuxt/eslint-config": "^0.3.13",
22+
"eslint": "^9.4.0",
23+
"vue-tsc": "^2.0.21",
24+
"wrangler": "^3.60.3"
25+
}
26+
}

Diff for: public/favicon.ico

4.19 KB
Binary file not shown.

Diff for: server/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../.nuxt/tsconfig.server.json"
3+
}

Diff for: tsconfig.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// https://nuxt.com/docs/guide/concepts/typescript
3+
"extends": "./.nuxt/tsconfig.json"
4+
}

0 commit comments

Comments
 (0)