├── .npmrc ├── app ├── assets │ └── css │ │ └── main.css ├── app.config.ts ├── components │ └── OgImage │ │ └── OgImagePage.vue ├── pages │ └── [[slug]].vue └── app.vue ├── public └── favicon.ico ├── .env.example ├── tsconfig.json ├── server ├── api │ ├── pages.ts │ ├── pages │ │ ├── [slug].get.ts │ │ └── [slug].put.ts │ └── login.post.ts └── routes │ └── assets │ └── [...pathname].get.ts ├── eslint.config.mjs ├── .gitignore ├── wrangler.jsonc ├── LICENSE ├── README.md ├── nuxt.config.ts └── package.json /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | -------------------------------------------------------------------------------- /app/assets/css/main.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | @import "@nuxt/ui"; 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atinux/atinotes/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | ADMIN_PASSWORD=your-admin-password 2 | NUXT_SESSION_PASSWORD=password-for-sealed-session-of-32-chars-min 3 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://nuxt.com/docs/guide/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /server/api/pages.ts: -------------------------------------------------------------------------------- 1 | import { kv } from 'hub:kv' 2 | 3 | export default eventHandler(async () => { 4 | return kv.keys() 5 | }) 6 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import withNuxt from './.nuxt/eslint.config.mjs' 3 | 4 | export default withNuxt( 5 | // Your custom configs here 6 | ) 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | dist 9 | .data 10 | data 11 | .wrangler 12 | wrangler.toml 13 | -------------------------------------------------------------------------------- /app/app.config.ts: -------------------------------------------------------------------------------- 1 | export default defineAppConfig({ 2 | ui: { 3 | colors: { 4 | primary: 'lime', 5 | neutral: 'neutral' 6 | } 7 | } 8 | }) 9 | -------------------------------------------------------------------------------- /wrangler.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "node_modules/wrangler/config-schema.json", 3 | "name": "atinotes", 4 | "observability": { 5 | "enabled": true 6 | }, 7 | "kv_namespaces": [ 8 | { 9 | "binding": "KV", 10 | "id": "2d0205a5567844e2bdc0db9ea926f7e9" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /server/routes/assets/[...pathname].get.ts: -------------------------------------------------------------------------------- 1 | export default eventHandler(async (event) => { 2 | const { pathname } = event.context.params || {} 3 | if (!pathname) { 4 | throw createError({ 5 | status: 400, 6 | message: 'Invalid path' 7 | }) 8 | } 9 | 10 | return hubBlob().serve(event, pathname) 11 | }) 12 | -------------------------------------------------------------------------------- /server/api/pages/[slug].get.ts: -------------------------------------------------------------------------------- 1 | import { kv } from 'hub:kv' 2 | 3 | interface Note { 4 | body: string 5 | parsed?: object 6 | } 7 | 8 | export default eventHandler(async (event) => { 9 | const { slug } = event.context.params || {} 10 | if (!slug) { 11 | throw createError({ statusCode: 400, message: 'Missing slug' }) 12 | } 13 | 14 | let note = await kv.get(slug) 15 | 16 | if (!note) { 17 | note = { body: '# Hello' } 18 | note.parsed = await parseMarkdown(note.body) 19 | } 20 | 21 | return { slug, ...note } 22 | }) 23 | -------------------------------------------------------------------------------- /server/api/pages/[slug].put.ts: -------------------------------------------------------------------------------- 1 | import { kv } from 'hub:kv' 2 | import { parseMarkdown } from '@nuxtjs/mdc/runtime' 3 | 4 | export default eventHandler(async (event) => { 5 | await requireUserSession(event) 6 | const { slug } = event.context.params || {} 7 | if (!slug) { 8 | throw createError({ statusCode: 400, message: 'Missing slug' }) 9 | } 10 | // Force being a string 11 | const { body } = await readBody(event) 12 | const parsed = await parseMarkdown(body) 13 | 14 | await kv.set(slug, { body, parsed }) 15 | 16 | return { slug, body, parsed } 17 | }) 18 | -------------------------------------------------------------------------------- /server/api/login.post.ts: -------------------------------------------------------------------------------- 1 | export default eventHandler(async (event) => { 2 | if (!process.env.ADMIN_PASSWORD) { 3 | throw createError({ 4 | statusCode: 500, 5 | message: 'Missing ADMIN_PASSWORD environment variable' 6 | }) 7 | } 8 | const { password } = (await readBody(event)) || {} 9 | if (password !== process.env.ADMIN_PASSWORD) { 10 | throw createError({ 11 | statusCode: 401, 12 | message: 'Wrong password' 13 | }) 14 | } 15 | await setUserSession(event, { 16 | user: { admin: true } 17 | }) 18 | return { ok: true } 19 | }) 20 | -------------------------------------------------------------------------------- /app/components/OgImage/OgImagePage.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Sébastien Chopin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Save your Markdown notes online with Atinotes 🖌️ 2 | 3 | Read more on https://notes.atinux.com 4 | 5 | ## Setup 6 | 7 | Make sure to install the dependencies: 8 | 9 | ```bash 10 | # pnpm 11 | pnpm install 12 | ``` 13 | 14 | ## Development Server 15 | 16 | Start the development server on http://localhost:3000 17 | 18 | ```bash 19 | pnpm run dev 20 | ``` 21 | 22 | Copy the `.env.example` to `.env` and update the variables to your own. 23 | 24 | ## Production 25 | 26 | Build the application for production: 27 | 28 | ```bash 29 | pnpm run build 30 | ``` 31 | 32 | Locally preview production build: 33 | 34 | ```bash 35 | pnpm run preview 36 | ``` 37 | 38 | Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. 39 | 40 | ## Deploy 41 | 42 | Add the following environement variables: 43 | 44 | ``` 45 | ADMIN_PASSWORD= 46 | NUXT_SESSION_PASSWORD= 47 | ``` 48 | 49 | Next, make sure to add your KV namespace to the `wrangler.jsonc` file. 50 | 51 | Once saved, the deployment will be updated with the new environment variables. 52 | 53 | That's all :sparkles: 54 | 55 | ## License 56 | 57 | [MIT](./LICENSE) - Sébastien Chopin 58 | -------------------------------------------------------------------------------- /nuxt.config.ts: -------------------------------------------------------------------------------- 1 | // https://nuxt.com/docs/api/configuration/nuxt-config 2 | export default defineNuxtConfig({ 3 | modules: [ 4 | '@nuxthub/core', 5 | '@nuxt/eslint', 6 | '@nuxt/ui', 7 | '@nuxtjs/mdc', 8 | 'nuxt-og-image', 9 | 'nuxt-auth-utils', 10 | '@nuxtjs/plausible' 11 | ], 12 | 13 | devtools: { 14 | enabled: true 15 | }, 16 | css: ['~/assets/css/main.css'], 17 | 18 | mdc: { 19 | highlight: { 20 | theme: { 21 | default: 'vitesse-light', 22 | dark: 'material-theme-palenight' 23 | } 24 | } 25 | }, 26 | 27 | ui: { 28 | content: true 29 | }, 30 | 31 | routeRules: { 32 | // Used for notes.atinux.com 33 | // Fell free to remove it 34 | '/nuxt-custom-fetch': { redirect: { to: 'https://nuxt.com/docs/guide/recipes/custom-usefetch', statusCode: 302 } } 35 | }, 36 | future: { compatibilityVersion: 4 }, 37 | compatibilityDate: '2025-12-10', 38 | 39 | hub: { 40 | kv: true 41 | }, 42 | 43 | eslint: { 44 | config: { 45 | stylistic: { 46 | quotes: 'single', 47 | commaDangle: 'never' 48 | } 49 | } 50 | }, 51 | 52 | ogImage: { 53 | compatibility: { 54 | runtime: { 55 | resvg: 'wasm' 56 | } 57 | } 58 | } 59 | }) 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "atinotes", 3 | "private": true, 4 | "packageManager": "pnpm@10.25.0", 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 | "@iconify-json/simple-icons": "^1.2.62", 15 | "@nuxt/eslint": "^1.12.1", 16 | "@nuxt/image": "^2.0.0", 17 | "@nuxt/ui": "^4.2.1", 18 | "@nuxthub/core": "^0.10.0", 19 | "@nuxtjs/mdc": "^0.19.1", 20 | "@nuxtjs/plausible": "^2.0.1", 21 | "nuxt": "^4.2.2", 22 | "nuxt-auth-utils": "^0.5.26", 23 | "nuxt-og-image": "5.1.12", 24 | "pathe": "^2.0.3", 25 | "scule": "^1.3.0" 26 | }, 27 | "devDependencies": { 28 | "@nuxt/devtools": "^3.1.1", 29 | "@nuxt/eslint-config": "^1.12.1", 30 | "@types/node": "^25.0.0", 31 | "eslint": "^9.39.1", 32 | "typescript": "^5.9.3", 33 | "vue-tsc": "^3.1.8", 34 | "wrangler": "^4.53.0" 35 | }, 36 | "pnpm": { 37 | "onlyBuiltDependencies": [ 38 | "@parcel/watcher", 39 | "@tailwindcss/oxide", 40 | "better-sqlite3", 41 | "esbuild", 42 | "sharp", 43 | "unrs-resolver", 44 | "vue-demi" 45 | ], 46 | "ignoredBuiltDependencies": [ 47 | "workerd" 48 | ] 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/pages/[[slug]].vue: -------------------------------------------------------------------------------- 1 | 52 | 53 |