├── .github
└── FUNDING.yml
├── bun.lockb
├── project.inlang
├── project_id
└── settings.json
├── static
├── favicon.ico
└── logo.svg
├── postcss.config.mjs
├── translations
├── en.json
└── it.json
├── src
├── routes
│ ├── +layout.server.ts
│ ├── inlang
│ │ └── [language].json
│ │ │ └── +server.ts
│ ├── protected
│ │ ├── +layout.server.ts
│ │ └── +page.svelte
│ ├── +error.svelte
│ ├── +layout.ts
│ ├── auth
│ │ └── callback
│ │ │ └── +server.ts
│ ├── +page.svelte
│ ├── +layout.svelte
│ ├── payment-example
│ │ └── +page.svelte
│ └── posts-example
│ │ └── +page.svelte
├── lib
│ ├── trpc
│ │ ├── routes
│ │ │ ├── hello.ts
│ │ │ ├── payments.ts
│ │ │ └── db.ts
│ │ ├── client.ts
│ │ ├── router.ts
│ │ ├── trpc.ts
│ │ └── context.ts
│ ├── db
│ │ ├── drizzle
│ │ │ ├── meta
│ │ │ │ ├── _journal.json
│ │ │ │ └── 0000_snapshot.json
│ │ │ ├── 0000_low_bushwacker.sql
│ │ │ └── schema.ts
│ │ └── index.ts
│ └── components
│ │ ├── InternationalizationExample.svelte
│ │ ├── LanguageSwitch.stories.ts
│ │ ├── TrpcButtons.stories.ts
│ │ ├── LoginForm.stories.ts
│ │ ├── LanguageSwitch.svelte
│ │ ├── TrpcButtons.svelte
│ │ └── LoginForm.svelte
├── global.css
├── app.html
├── app.d.ts
└── hooks.server.ts
├── .prettierrc
├── .eslintignore
├── .prettierignore
├── .gitignore
├── .devcontainer
└── devcontainer.json
├── .vscode
├── extensions.json
└── settings.json
├── .gitpod.yml
├── drizzle.config.ts
├── vercel.json
├── tsconfig.json
├── .env.local.example
├── svelte.config.js
├── .storybook
├── main.ts
└── preview.ts
├── vite.config.ts
├── .eslintrc.cjs
├── tailwind.config.cjs
├── install.sh
├── package.json
├── README.md
└── LICENSE
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: albbus-stack
2 |
--------------------------------------------------------------------------------
/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/albbus-stack/kit-stack/HEAD/bun.lockb
--------------------------------------------------------------------------------
/project.inlang/project_id:
--------------------------------------------------------------------------------
1 | 4a04bb262f725edcf2c3f085ae1e37967ccedf23d929ef908344f14d548b7644
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/albbus-stack/kit-stack/HEAD/static/favicon.ico
--------------------------------------------------------------------------------
/postcss.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {}
5 | }
6 | };
7 |
--------------------------------------------------------------------------------
/translations/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://inlang.com/schema/inlang-message-format",
3 | "title": "Welcome!"
4 | }
--------------------------------------------------------------------------------
/translations/it.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://inlang.com/schema/inlang-message-format",
3 | "title": "Benvenuto!"
4 | }
--------------------------------------------------------------------------------
/src/routes/+layout.server.ts:
--------------------------------------------------------------------------------
1 | import type { RequestEvent } from './$types';
2 |
3 | export const load = async ({ locals: { getSession } }: RequestEvent) => {
4 | return {
5 | session: await getSession()
6 | };
7 | };
8 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "useTabs": true,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "printWidth": 100,
6 | "pluginSearchDirs": ["."],
7 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
8 | }
9 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 |
10 | # Ignore files for PNPM, NPM and YARN
11 | pnpm-lock.yaml
12 | package-lock.json
13 | yarn.lock
14 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 |
10 | # Ignore files for PNPM, NPM and YARN
11 | pnpm-lock.yaml
12 | package-lock.json
13 | yarn.lock
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 | !.env.local.example
10 | vite.config.js.timestamp-*
11 | vite.config.ts.timestamp-*
12 | .vercel
13 | /storybook-static
--------------------------------------------------------------------------------
/src/lib/trpc/routes/hello.ts:
--------------------------------------------------------------------------------
1 | import { publicProcedure, router } from '../trpc';
2 |
3 | export const helloRouter = router({
4 | greeting: publicProcedure.query(async () => {
5 | return `Hello from tRPC @ ${new Date().toLocaleTimeString()}`;
6 | })
7 | });
8 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "postAttachCommand": {
3 | "install": "curl -fsSL https://bun.sh/install | bash && source /home/codespace/.bashrc && bun install && bun db:generate && cp .env.local.example .env.local && bun env:sync"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "esbenp.prettier-vscode",
4 | "svelte.svelte-vscode",
5 | "bradlc.vscode-tailwindcss",
6 | "pmneo.tsimporter",
7 | "kuscamara.remove-unused-imports",
8 | "inlang.vs-code-extension"
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/src/global.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | html {
6 | scrollbar-width: thin !important;
7 | }
8 |
9 | body {
10 | font-family: 'Montserrat Alternates', sans-serif;
11 | overflow-x: hidden;
12 | overflow-y: scroll;
13 | }
14 |
--------------------------------------------------------------------------------
/src/lib/db/drizzle/meta/_journal.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "5",
3 | "dialect": "pg",
4 | "entries": [
5 | {
6 | "idx": 0,
7 | "version": "5",
8 | "when": 1695146791927,
9 | "tag": "0000_low_bushwacker",
10 | "breakpoints": true
11 | }
12 | ]
13 | }
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | tasks:
2 | - name: Install and Setup with Bun
3 | command: |
4 | curl -fsSL https://bun.sh/install | bash
5 | source /home/gitpod/.bashrc
6 | bun install
7 | bun db:generate
8 | cp .env.local.example .env.local
9 | bun lang:build
10 | bun env:sync
--------------------------------------------------------------------------------
/drizzle.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from "drizzle-kit";
2 |
3 | export default {
4 | schema: "./src/lib/db/drizzle/schema.ts",
5 | out: "./src/lib/db/drizzle",
6 | driver: "pg",
7 | dbCredentials: {
8 | connectionString: process.env.DATABASE_URL as string,
9 | }
10 | } satisfies Config;
--------------------------------------------------------------------------------
/src/lib/components/InternationalizationExample.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
{m.title()}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/lib/trpc/client.ts:
--------------------------------------------------------------------------------
1 | import type { Router } from '$lib/trpc/router';
2 | import { createTRPCClient, type TRPCClientInit } from 'trpc-sveltekit';
3 | import superjson from 'superjson';
4 |
5 | export function trpc(init?: TRPCClientInit) {
6 | return createTRPCClient({
7 | transformer: superjson,
8 | init
9 | });
10 | }
11 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://openapi.vercel.sh/vercel.json",
3 | "installCommand": "curl -fsSL https://bun.sh/install | bash && ~/.bun/bin/bun install --frozen-lockfile",
4 | "devCommand": "~/.bun/bin/bun dev",
5 | "buildCommand": "~/.bun/bin/bun vercel:build",
6 | "framework": "sveltekit",
7 | "outputDirectory": ".svelte-kit/output"
8 | }
--------------------------------------------------------------------------------
/src/routes/inlang/[language].json/+server.ts:
--------------------------------------------------------------------------------
1 | /* This file was created by inlang.
2 | It is needed in order to circumvent a current limitation of SvelteKit. See https://github.com/inlang/inlang/issues/647
3 | You can remove this comment and modify the file as you like. We just need to make sure it exists.
4 | Please do not delete it (inlang will recreate it if needed). */
--------------------------------------------------------------------------------
/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true,
12 | "moduleResolution": "Bundler"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.env.local.example:
--------------------------------------------------------------------------------
1 | DATABASE_URL=postgresql://postgres:[password]@localhost:5432/postgres
2 |
3 | # Find these in your Supabase project settings https://supabase.com/dashboard/project/_/settings/api
4 | PUBLIC_SUPABASE_URL=
5 | PUBLIC_SUPABASE_ANON_KEY=
6 |
7 | # Find these in your Stripe project settings https://dashboard.stripe.com/test/apikeys
8 | PUBLIC_STRIPE_KEY=
9 | SECRET_STRIPE_KEY=
--------------------------------------------------------------------------------
/src/lib/trpc/router.ts:
--------------------------------------------------------------------------------
1 | import { router } from './trpc';
2 | import { helloRouter } from './routes/hello';
3 | import { dbRouter } from './routes/db';
4 | import { paymentsRouter } from './routes/payments';
5 |
6 | export const appRouter = router({
7 | hello: helloRouter,
8 | db: dbRouter,
9 | payments: paymentsRouter
10 | });
11 |
12 | export type Router = typeof appRouter;
13 |
--------------------------------------------------------------------------------
/svelte.config.js:
--------------------------------------------------------------------------------
1 | import adapter from '@sveltejs/adapter-vercel';
2 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
3 |
4 | /** @type {import('@sveltejs/kit').Config} */
5 | const config = {
6 | preprocess: vitePreprocess(),
7 |
8 | kit: {
9 | adapter: adapter(),
10 | alias: {
11 | $paraglide: './src/paraglide'
12 | }
13 | }
14 | };
15 |
16 | export default config;
17 |
--------------------------------------------------------------------------------
/src/app.d.ts:
--------------------------------------------------------------------------------
1 | import { SupabaseClient, Session } from '@supabase/supabase-js';
2 |
3 | declare global {
4 | namespace App {
5 | interface Locals {
6 | supabase: SupabaseClient;
7 | getSession(): Promise;
8 | }
9 | interface PageData {
10 | session: Session | null;
11 | }
12 | // interface Error {}
13 | // interface Platform {}
14 | }
15 | }
16 |
17 | export {};
18 |
--------------------------------------------------------------------------------
/src/lib/components/LanguageSwitch.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/svelte';
2 | import LanguageSwitch from './LanguageSwitch.svelte';
3 |
4 | const meta = {
5 | title: 'Components/LanguageSwitch',
6 | component: LanguageSwitch,
7 | } satisfies Meta;
8 |
9 | export default meta;
10 | type Story = StoryObj;
11 |
12 | export const Demo: Story = {};
--------------------------------------------------------------------------------
/src/routes/protected/+layout.server.ts:
--------------------------------------------------------------------------------
1 | import { redirect } from '@sveltejs/kit';
2 | import type { RequestEvent } from '../$types';
3 |
4 | // This is a protected route, so we need to check if the user is logged in, otherwise we redirect
5 | export async function load({ locals: { getSession } }: RequestEvent) {
6 | const session = await getSession();
7 | if (!session) {
8 | redirect(302, '/');
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/lib/components/TrpcButtons.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/svelte';
2 |
3 | import TrpcButtons from './TrpcButtons.svelte';
4 |
5 | const meta = {
6 | title: 'Components/TrpcButtons',
7 | component: TrpcButtons,
8 | tags: ['autodocs'],
9 | } satisfies Meta;
10 |
11 | export default meta;
12 | type Story = StoryObj;
13 |
14 | export const Buttons: Story = {};
15 |
--------------------------------------------------------------------------------
/src/lib/db/index.ts:
--------------------------------------------------------------------------------
1 | import { drizzle } from "drizzle-orm/postgres-js"
2 | import { DATABASE_URL } from "$env/static/private";
3 | import * as schema from './drizzle/schema';
4 | import postgres from "postgres"
5 |
6 | const client = postgres(DATABASE_URL)
7 |
8 | // This is a bug in the drizzle types against the postgres ones.
9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
10 | export const db = drizzle(client as any, { schema });
--------------------------------------------------------------------------------
/.storybook/main.ts:
--------------------------------------------------------------------------------
1 | import type { StorybookConfig } from '@storybook/sveltekit';
2 |
3 | const config: StorybookConfig = {
4 | stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5 | addons: [
6 | '@storybook/addon-links',
7 | '@storybook/addon-essentials',
8 | '@storybook/addon-interactions',
9 | '@storybook/addon-actions',
10 | '@storybook/addon-styling'
11 | ],
12 | framework: '@storybook/sveltekit'
13 | };
14 | export default config;
15 |
--------------------------------------------------------------------------------
/src/routes/protected/+page.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
14 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from '@sveltejs/kit/vite';
2 | import { defineConfig } from 'vite';
3 | import { paraglide } from '@inlang/paraglide-js-adapter-vite';
4 |
5 | export default defineConfig({
6 | optimizeDeps: {
7 | exclude: ['@inlang/paraglide-js']
8 | },
9 | ssr: {
10 | noExternal: ['@inlang/paraglide-js']
11 | },
12 | plugins: [
13 | paraglide({
14 | project: './project.inlang',
15 | outdir: './src/paraglide'
16 | }),
17 | sveltekit()
18 | ]
19 | });
20 |
--------------------------------------------------------------------------------
/.storybook/preview.ts:
--------------------------------------------------------------------------------
1 | import type { Preview } from '@storybook/svelte';
2 | import { withThemeByDataAttribute } from '@storybook/addon-styling';
3 |
4 | import '../src/global.css';
5 | import '@fontsource/montserrat-alternates';
6 |
7 | const preview: Preview = {
8 | parameters: {
9 | actions: { argTypesRegex: '^on[A-Z].*' },
10 | controls: {
11 | matchers: {
12 | color: /(background|color)$/i,
13 | date: /Date$/
14 | }
15 | }
16 | }
17 | };
18 |
19 | export default preview;
20 |
--------------------------------------------------------------------------------
/src/routes/+error.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
{$page.error?.message || ''}
11 |
Home
12 |
13 |
--------------------------------------------------------------------------------
/src/routes/+layout.ts:
--------------------------------------------------------------------------------
1 | import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from '$env/static/public';
2 | import { createSupabaseLoadClient } from '@supabase/auth-helpers-sveltekit';
3 | import type { LayoutLoadEvent } from './$types';
4 |
5 | export const load = async ({ fetch, data, depends, url }: LayoutLoadEvent) => {
6 | depends('supabase:auth');
7 |
8 | // Initialize supabase
9 | const supabase = createSupabaseLoadClient({
10 | supabaseUrl: PUBLIC_SUPABASE_URL,
11 | supabaseKey: PUBLIC_SUPABASE_ANON_KEY,
12 | event: { fetch },
13 | serverSession: data?.session
14 | });
15 |
16 | const {
17 | data: { session }
18 | } = await supabase.auth.getSession();
19 |
20 | return { supabase, session, url: url.pathname };
21 | };
22 |
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: [
4 | "eslint:recommended",
5 | "plugin:@typescript-eslint/recommended",
6 | "plugin:svelte/recommended",
7 | "prettier",
8 | "plugin:storybook/recommended"
9 | ],
10 | parser: '@typescript-eslint/parser',
11 | plugins: ['@typescript-eslint'],
12 | parserOptions: {
13 | sourceType: 'module',
14 | ecmaVersion: 2020,
15 | extraFileExtensions: ['.svelte']
16 | },
17 | env: {
18 | browser: true,
19 | es2017: true,
20 | node: true
21 | },
22 | overrides: [
23 | {
24 | files: ['*.svelte'],
25 | parser: 'svelte-eslint-parser',
26 | parserOptions: {
27 | parser: '@typescript-eslint/parser'
28 | }
29 | }
30 | ]
31 | };
32 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.formatOnSave": true,
3 | "editor.formatOnPaste": true,
4 | "svelte.enable-ts-plugin": true,
5 | "[svelte]": {
6 | "editor.defaultFormatter": "esbenp.prettier-vscode"
7 | },
8 | "prettier.documentSelectors": ["**/*.svelte"],
9 | "files.exclude": {
10 | "**/.svelte-kit": true,
11 | "**/node_modules": true,
12 | "LICENSE": true,
13 | },
14 | "explorer.fileNesting.enabled": true,
15 | "explorer.fileNesting.patterns": {
16 | "package.json": ".eslint*, .gitpod*, .bun*, bun*, .prettier*, vercel*, tsconfig*, drizzle.config*",
17 | "svelte.config.*": "inlang.config*, vite.config*, project.inlang*",
18 | "tailwind.config.*": "postcss.config*",
19 | "*.svelte": "${capture}.stories.ts",
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/lib/trpc/routes/payments.ts:
--------------------------------------------------------------------------------
1 | import { z } from 'zod';
2 | import { publicProcedure, router } from '../trpc';
3 |
4 | export type PaymentIntent = { clientSecret: string | null };
5 |
6 | export const paymentsRouter = router({
7 | paymentIntent: publicProcedure
8 | .input(
9 | z.object({
10 | amount: z.number()
11 | })
12 | )
13 | .query(async ({ ctx, input }) => {
14 | // Review on the Stripe docs all the possible params that can be passed in
15 | const paymentIntent = await ctx.stripe.paymentIntents.create({
16 | amount: input.amount,
17 | currency: 'usd',
18 | automatic_payment_methods: {
19 | enabled: true
20 | }
21 | });
22 |
23 | return {
24 | clientSecret: paymentIntent.client_secret
25 | } as PaymentIntent;
26 | })
27 | });
28 |
--------------------------------------------------------------------------------
/src/lib/trpc/trpc.ts:
--------------------------------------------------------------------------------
1 | import { initTRPC, TRPCError } from '@trpc/server';
2 | import superjson from 'superjson';
3 | import type { Context } from './context';
4 |
5 | const t = initTRPC.context().create({
6 | transformer: superjson,
7 | errorFormatter({ shape }) {
8 | return shape;
9 | }
10 | });
11 |
12 | // This is a middleware that checks if the user is authenticated
13 | const isAuthed = t.middleware(({ next, ctx }) => {
14 | if (!ctx.user) {
15 | throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Not authenticated' });
16 | }
17 | return next({
18 | ctx: {
19 | user: ctx.user
20 | }
21 | });
22 | });
23 |
24 | export const router = t.router;
25 | export const publicProcedure = t.procedure;
26 | export const protectedProcedure = t.procedure.use(isAuthed);
27 |
--------------------------------------------------------------------------------
/src/routes/auth/callback/+server.ts:
--------------------------------------------------------------------------------
1 | import { redirect } from '@sveltejs/kit';
2 | import type { RequestHandler } from './$types';
3 | import { db } from '$lib/db';
4 | import { user } from '$lib/db/drizzle/schema';
5 |
6 | // Handles the callback from the OAuth provider, receiving a certain code that can be exhanged for a session
7 | export const GET: RequestHandler = async ({ url, locals: { supabase } }) => {
8 | const code = url.searchParams.get('code');
9 |
10 | if (code) {
11 | await supabase.auth.exchangeCodeForSession(code);
12 | }
13 |
14 | const userData = (await supabase.auth.getUser()).data;
15 |
16 | if (!userData?.user?.email) redirect(302, '/');
17 |
18 | await db.insert(user).values({
19 | email: userData.user.email,
20 | id: userData.user.id
21 | });
22 |
23 | redirect(301, '/');
24 | };
25 |
--------------------------------------------------------------------------------
/src/lib/db/drizzle/0000_low_bushwacker.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS "Post" (
2 | "id" serial PRIMARY KEY NOT NULL,
3 | "title" text NOT NULL,
4 | "content" text,
5 | "createdAt" timestamp(3) DEFAULT now() NOT NULL,
6 | "updatedAt" timestamp(3) DEFAULT now() NOT NULL,
7 | "published" boolean DEFAULT false NOT NULL,
8 | "authorId" text
9 | );
10 | --> statement-breakpoint
11 | CREATE TABLE IF NOT EXISTS "User" (
12 | "id" text PRIMARY KEY NOT NULL,
13 | "email" text NOT NULL,
14 | "name" text,
15 | CONSTRAINT "User_email_unique" UNIQUE("email")
16 | );
17 | --> statement-breakpoint
18 | DO $$ BEGIN
19 | ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_User_id_fk" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE set null ON UPDATE cascade;
20 | EXCEPTION
21 | WHEN duplicate_object THEN null;
22 | END $$;
23 |
--------------------------------------------------------------------------------
/src/lib/trpc/context.ts:
--------------------------------------------------------------------------------
1 | import { SECRET_STRIPE_KEY } from '$env/static/private';
2 | import { db } from '$lib/db';
3 | import type { RequestEvent } from '@sveltejs/kit';
4 | import type { inferAsyncReturnType } from '@trpc/server';
5 | import Stripe from 'stripe';
6 |
7 | // Initialize stripe
8 | const stripe = new Stripe(SECRET_STRIPE_KEY, {
9 | apiVersion: '2024-04-10'
10 | });
11 |
12 | export async function createContext(event: RequestEvent) {
13 | // Fetch the user infos (currently only the id) from the session
14 | const getUser = async () => {
15 | const session = await event.locals.getSession();
16 | if (!session) return null;
17 |
18 | return session.user.id;
19 | };
20 |
21 | return {
22 | db,
23 | stripe,
24 | user: await getUser()
25 | };
26 | }
27 |
28 | export type Context = inferAsyncReturnType;
29 |
--------------------------------------------------------------------------------
/src/lib/db/drizzle/schema.ts:
--------------------------------------------------------------------------------
1 | import type { InferSelectModel } from "drizzle-orm";
2 | import { pgTable, timestamp, text, serial, boolean } from "drizzle-orm/pg-core";
3 |
4 | export const post = pgTable("Post", {
5 | id: serial("id").primaryKey().notNull(),
6 | title: text("title").notNull(),
7 | content: text("content"),
8 | createdAt: timestamp("createdAt", { precision: 3, mode: 'string' }).defaultNow().notNull(),
9 | updatedAt: timestamp("updatedAt", { precision: 3, mode: 'string' }).defaultNow().notNull(),
10 | published: boolean("published").default(false).notNull(),
11 | authorId: text("authorId").references(() => user.id, { onDelete: "set null", onUpdate: "cascade" } ),
12 | });
13 | export type Post = InferSelectModel
14 |
15 | export const user = pgTable("User", {
16 | id: text("id").primaryKey().notNull(),
17 | email: text("email").notNull().unique(),
18 | name: text("name"),
19 | });
20 | export type User = InferSelectModel
--------------------------------------------------------------------------------
/project.inlang/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://inlang.com/schema/project-settings",
3 | "sourceLanguageTag": "en",
4 | "languageTags": [
5 | "en",
6 | "it"
7 | ],
8 | "modules": [
9 | "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
10 | "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
11 | "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
12 | "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
13 | "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
14 | "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
15 | "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
16 | ],
17 | "plugin.inlang.messageFormat": {
18 | "pathPattern": "./translations/{languageTag}.json"
19 | }
20 | }
--------------------------------------------------------------------------------
/src/lib/components/LoginForm.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/svelte';
2 |
3 | import LoginForm from './LoginForm.svelte';
4 | import type { SupabaseClient } from '@supabase/supabase-js';
5 |
6 | const meta = {
7 | title: 'Components/LoginForm',
8 | component: LoginForm,
9 | args:{
10 | data: {
11 | supabase: null as unknown as SupabaseClient,
12 | session: null,
13 | url: ""
14 | },
15 | },
16 | argTypes: {
17 | type: {
18 | control: { type: 'radio' },
19 | options: ['demo', 'signup', 'signin', 'signout'],
20 | }
21 | }
22 | } satisfies Meta;
23 |
24 | export default meta;
25 | type Story = StoryObj;
26 |
27 | export const Demo: Story = {
28 | args: {
29 | type: "demo"
30 | }
31 | };
32 |
33 | export const Signup: Story = {
34 | args: {
35 | type: "signup"
36 | }
37 | };
38 |
39 | export const Signin: Story = {
40 | args: {
41 | type: "signin"
42 | }
43 | };
44 |
45 | export const Signout: Story = {
46 | args: {
47 | type: "signout"
48 | }
49 | };
--------------------------------------------------------------------------------
/tailwind.config.cjs:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 |
3 | /** @type {import('tailwindcss').Config} */
4 | export default {
5 | content: ['./src/**/*.{html,js,svelte,ts}'],
6 | theme: {
7 | extend: {}
8 | },
9 | plugins: [require('daisyui')],
10 | daisyui: {
11 | themes: [
12 | {
13 | light: {
14 | ...require('daisyui/src/theming/themes')['light'],
15 | primary: '#f5602f',
16 | 'primary-content': '#ffffff',
17 | 'secondary-content': '#ffffff',
18 | 'accent-content': '#ffffff',
19 | 'success-content': '#ffffff',
20 | 'info-content': '#ffffff',
21 | 'warning-content': '#ffffff',
22 | 'error-content': '#ffffff',
23 | },
24 | dark: {
25 | ...require('daisyui/src/theming/themes')['dark'],
26 | primary: '#f5602f',
27 | 'primary-content': '#ffffff',
28 | 'secondary-content': '#ffffff',
29 | 'accent-content': '#ffffff',
30 | 'success-content': '#ffffff',
31 | 'info-content': '#ffffff',
32 | 'warning-content': '#ffffff',
33 | 'error-content': '#ffffff',
34 | }
35 |
36 | }
37 | ]
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | folderName=$1
3 |
4 | if [ -z $folderName ]
5 | then folderName="kit-stack"
6 | fi
7 |
8 | echo
9 | echo -e " _ _ _ _ _\n| | __(_)| |_ ___ | |_ __ _ ___ | | __ \n| |/ /| || __| / __|| __| / _\` | / __|| |/ / \n| < | || |_ \__ \| |_ | (_| || (__ | < \n|_|\_\|_| \__| |___/ \__| \__,_| \___||_|\_\\"
10 | echo
11 | echo -e "\033[1;32m🐙 Cloning into $folderName\033[0m"
12 | echo
13 |
14 | git clone https://github.com/albbus-stack/kit-stack.git $folderName
15 | cd $folderName
16 |
17 | echo
18 | echo -e "\033[1;32m🗑️\x20 Cleaning up files\033[0m"
19 | echo
20 |
21 | rm -rf .git LICENSE install.sh install.ps1
22 | mv .env.local.example .env.local
23 |
24 | echo -e "\033[1;32m🥯 Installing dependencies\033[0m"
25 | echo
26 |
27 | bun install
28 |
29 | echo
30 | echo -e "\033[1;32m⚙️\x20 Running setup scripts\033[0m"
31 | echo
32 |
33 | bun db:generate
34 | bun lang:build
35 | bun env:sync
36 | git init
37 |
38 | echo
39 | echo -e "\033[1;32m✔️\x20 Setup completed!\033[1;33m Cd into $folderName, fill in your Supabase env keys and run \`bun dev\`\033[0m"
40 | echo
41 |
--------------------------------------------------------------------------------
/src/hooks.server.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from '$lib/trpc/context';
2 | import { appRouter } from '$lib/trpc/router';
3 | import type { Handle } from '@sveltejs/kit';
4 | import { createTRPCHandle } from 'trpc-sveltekit';
5 | import { sequence } from '@sveltejs/kit/hooks';
6 | import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public';
7 | import { createSupabaseServerClient } from '@supabase/auth-helpers-sveltekit';
8 |
9 | const trpc: Handle = createTRPCHandle({ router: appRouter, createContext });
10 |
11 | const supabaseAuth: Handle = async ({ event, resolve }) => {
12 | event.locals.supabase = createSupabaseServerClient({
13 | supabaseUrl: PUBLIC_SUPABASE_URL,
14 | supabaseKey: PUBLIC_SUPABASE_ANON_KEY,
15 | event
16 | });
17 |
18 | /**
19 | * a little helper that is written for convenience so that instead
20 | * of calling `const { data: { session } } = await supabase.auth.getSession()`
21 | * you just call this `await getSession()`
22 | */
23 | event.locals.getSession = async () => {
24 | const {
25 | data: { session }
26 | } = await event.locals.supabase.auth.getSession();
27 | return session;
28 | };
29 |
30 | return resolve(event, {
31 | filterSerializedResponseHeaders(name) {
32 | return name === 'content-range';
33 | }
34 | });
35 | };
36 |
37 | export const handle: Handle = sequence(supabaseAuth, trpc);
38 |
--------------------------------------------------------------------------------
/src/lib/components/LanguageSwitch.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {#each availableLanguageTags as languageTag}
16 | {#if languageTag !== lang}
17 |
18 | {
20 | setLanguageTag(languageTag)
21 | }}
22 | class="p-2 py-1"
23 | >
24 |
25 |
26 |
27 | {/if}
28 | {/each}
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/routes/+page.svelte:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Trpc Queries
16 |
17 |
18 |
19 |
20 |
21 |
25 |
26 |
27 |
Stripe Payment Example
28 |
Stripe
29 |
30 |
31 |
32 |
Posts CRUD example
33 |
Posts
34 |
35 |
36 |
37 |
Internationalization
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/lib/components/TrpcButtons.svelte:
--------------------------------------------------------------------------------
1 |
40 |
41 |
42 |
43 |
Load
50 |
{loading ? 'Loading...' : greeting}
51 |
52 |
53 |
Load Authed
60 |
{authedLoading ? 'Loading...' : authedGreeting}
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/routes/+layout.svelte:
--------------------------------------------------------------------------------
1 |
46 |
47 | {#if isLoading}
48 |
49 |
50 |
51 | {:else}
52 | {#key data.url + languageTag}
53 |
57 |
58 |
59 | {/key}
60 | {/if}
61 |
--------------------------------------------------------------------------------
/src/lib/trpc/routes/db.ts:
--------------------------------------------------------------------------------
1 | import { z } from 'zod';
2 | import { protectedProcedure, router } from '../trpc';
3 | import { TRPCClientError } from '@trpc/client';
4 | import { post } from '$lib/db/drizzle/schema';
5 | import { eq } from 'drizzle-orm';
6 |
7 | export const dbRouter = router({
8 | greeting: protectedProcedure.query(async () => {
9 | return `Hello from the authed db @ ${new Date().toLocaleTimeString()}`;
10 | }),
11 | createPost: protectedProcedure
12 | .input(
13 | z.object({
14 | title: z.string(),
15 | content: z.string()
16 | })
17 | )
18 | .mutation(async ({ ctx, input }) => {
19 | const { user, db } = ctx;
20 |
21 | // REMOVE THIS CHECK
22 | // It prevents post creation spamming on the live demo
23 | if(user !== "50c7cfa4-7d29-498d-9725-902d8e6618c2") {
24 | throw new TRPCClientError("You are not authorized to create a post.")
25 | }
26 |
27 | const p = await db.insert(post).values({
28 | title: input.title,
29 | content: input.content,
30 | authorId: ctx.user
31 | }).returning();
32 |
33 | return p;
34 | }),
35 | getPosts: protectedProcedure.query(async ({ ctx }) => {
36 | const { db } = ctx;
37 |
38 | const posts = await db.query.post.findMany();
39 |
40 | return posts;
41 | }),
42 | updatePost: protectedProcedure
43 | .input(
44 | z.object({
45 | postId: z.number(),
46 | title: z.string(),
47 | content: z.string()
48 | })
49 | )
50 | .mutation(async ({ ctx, input }) => {
51 | const { db } = ctx;
52 |
53 | const p = await db.update(post).set({
54 | title: input.title,
55 | content: input.content
56 | }).where(eq(post.id, input.postId)).returning();
57 |
58 | return p;
59 | }),
60 | deletePost: protectedProcedure
61 | .input(z.object({ postId: z.number() }))
62 | .mutation(async ({ ctx, input }) => {
63 | const { db } = ctx;
64 |
65 | const p = await db.delete(post).where(eq(post.id, input.postId));
66 |
67 | return p;
68 | })
69 | });
70 |
--------------------------------------------------------------------------------
/src/lib/db/drizzle/meta/0000_snapshot.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "5",
3 | "dialect": "pg",
4 | "id": "5a68c5b4-9334-4aec-9c67-2d2a35b26ee4",
5 | "prevId": "00000000-0000-0000-0000-000000000000",
6 | "tables": {
7 | "Post": {
8 | "name": "Post",
9 | "schema": "",
10 | "columns": {
11 | "id": {
12 | "name": "id",
13 | "type": "serial",
14 | "primaryKey": true,
15 | "notNull": true
16 | },
17 | "title": {
18 | "name": "title",
19 | "type": "text",
20 | "primaryKey": false,
21 | "notNull": true
22 | },
23 | "content": {
24 | "name": "content",
25 | "type": "text",
26 | "primaryKey": false,
27 | "notNull": false
28 | },
29 | "createdAt": {
30 | "name": "createdAt",
31 | "type": "timestamp(3)",
32 | "primaryKey": false,
33 | "notNull": true,
34 | "default": "now()"
35 | },
36 | "updatedAt": {
37 | "name": "updatedAt",
38 | "type": "timestamp(3)",
39 | "primaryKey": false,
40 | "notNull": true,
41 | "default": "now()"
42 | },
43 | "published": {
44 | "name": "published",
45 | "type": "boolean",
46 | "primaryKey": false,
47 | "notNull": true,
48 | "default": false
49 | },
50 | "authorId": {
51 | "name": "authorId",
52 | "type": "text",
53 | "primaryKey": false,
54 | "notNull": false
55 | }
56 | },
57 | "indexes": {},
58 | "foreignKeys": {
59 | "Post_authorId_User_id_fk": {
60 | "name": "Post_authorId_User_id_fk",
61 | "tableFrom": "Post",
62 | "tableTo": "User",
63 | "columnsFrom": [
64 | "authorId"
65 | ],
66 | "columnsTo": [
67 | "id"
68 | ],
69 | "onDelete": "set null",
70 | "onUpdate": "cascade"
71 | }
72 | },
73 | "compositePrimaryKeys": {},
74 | "uniqueConstraints": {}
75 | },
76 | "User": {
77 | "name": "User",
78 | "schema": "",
79 | "columns": {
80 | "id": {
81 | "name": "id",
82 | "type": "text",
83 | "primaryKey": true,
84 | "notNull": true
85 | },
86 | "email": {
87 | "name": "email",
88 | "type": "text",
89 | "primaryKey": false,
90 | "notNull": true
91 | },
92 | "name": {
93 | "name": "name",
94 | "type": "text",
95 | "primaryKey": false,
96 | "notNull": false
97 | }
98 | },
99 | "indexes": {},
100 | "foreignKeys": {},
101 | "compositePrimaryKeys": {},
102 | "uniqueConstraints": {
103 | "User_email_unique": {
104 | "name": "User_email_unique",
105 | "nullsNotDistinct": false,
106 | "columns": [
107 | "email"
108 | ]
109 | }
110 | }
111 | }
112 | },
113 | "enums": {},
114 | "schemas": {},
115 | "_meta": {
116 | "schemas": {},
117 | "tables": {},
118 | "columns": {}
119 | }
120 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "kit-stack",
3 | "version": "1.0.0",
4 | "type": "module",
5 | "private": true,
6 | "engines": {
7 | "node": ">=20.0.0"
8 | },
9 | "scripts": {
10 | "dev": "bun db:generate && bun vite:dev",
11 | "build": "bun lang:build && bun db:generate && bun vite:build",
12 | "vite:dev": "bun vite dev",
13 | "vite:build": "bun vite build",
14 | "db:generate": "bun drizzle-kit generate:pg",
15 | "db:push": "bun drizzle-kit push:pg",
16 | "db:pull": "bun drizzle-kit introspect:pg",
17 | "db:studio": "bun drizzle-kit studio",
18 | "lang:studio": "bun x @inlang/cli open editor",
19 | "lang:build": "paraglide-js compile --project ./project.inlang",
20 | "preview": "bun vite preview",
21 | "lint": "prettier --plugin-search-dir . --check . && eslint .",
22 | "format": "prettier --plugin-search-dir . --write .",
23 | "env:sync": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
24 | "vercel:build": "~/.bun/bin/bun env:sync && ~/.bun/bin/bun db:push && ~/.bun/bin/bun vite:build",
25 | "storybook": "STORYBOOK=true storybook dev -p 6006 -s ../static",
26 | "storybook:build": "STORYBOOK=true storybook build -s ../static",
27 | "storybook:serve": "bun x serve storybook-static",
28 | "deps:update": "bun x npm-check-updates -ui",
29 | "clean": "rm -rf node_modules/ bun.lockb",
30 | "postinstall": "paraglide-js compile --project ./project.inlang"
31 | },
32 | "devDependencies": {
33 | "@inlang/paraglide-js": "1.7.0",
34 | "@inlang/paraglide-js-adapter-vite": "^1.2.40",
35 | "@storybook/addon-actions": "^8.0.9",
36 | "@storybook/addon-essentials": "^8.0.9",
37 | "@storybook/addon-interactions": "^8.0.9",
38 | "@storybook/addon-links": "^8.0.9",
39 | "@storybook/addon-styling": "^1.3.7",
40 | "@storybook/blocks": "^8.0.9",
41 | "@storybook/svelte": "^8.0.9",
42 | "@storybook/sveltekit": "^8.0.9",
43 | "@storybook/testing-library": "^0.2.2",
44 | "@stripe/stripe-js": "^3.3.0",
45 | "@sveltejs/adapter-vercel": "^5.3.0",
46 | "@sveltejs/kit": "^2.5.7",
47 | "@sveltejs/vite-plugin-svelte": "^3.1.0",
48 | "@typescript-eslint/eslint-plugin": "^7.7.1",
49 | "@typescript-eslint/parser": "^7.7.1",
50 | "autoprefixer": "^10.4.19",
51 | "drizzle-kit": "^0.20.17",
52 | "eslint": "^9.1.1",
53 | "eslint-config-prettier": "^9.1.0",
54 | "eslint-plugin-storybook": "^0.8.0",
55 | "eslint-plugin-svelte": "^2.38.0",
56 | "pg": "^8.11.5",
57 | "postcss": "^8.4.38",
58 | "prettier": "^3.2.5",
59 | "prettier-plugin-svelte": "^3.2.3",
60 | "prettier-plugin-tailwindcss": "^0.5.14",
61 | "react": "^18.2.0",
62 | "react-dom": "^18.2.0",
63 | "sk-seo": "^0.2.2",
64 | "storybook": "^8.0.9",
65 | "stripe": "^15.3.0",
66 | "svelte": "^4.2.15",
67 | "svelte-check": "^3.6.9",
68 | "svelte-hero-icons": "^5.1.0",
69 | "svelte-stripe": "^1.1.7",
70 | "tailwindcss": "^3.4.3",
71 | "tslib": "^2.6.2",
72 | "typescript": "^5.4.5",
73 | "vite": "^5.2.10"
74 | },
75 | "dependencies": {
76 | "@felte/reporter-svelte": "^1.1.11",
77 | "@felte/validator-zod": "^1.0.17",
78 | "@fontsource/montserrat": "^5.0.18",
79 | "@fontsource/montserrat-alternates": "^5.0.13",
80 | "@supabase/auth-helpers-sveltekit": "^0.12.0",
81 | "@supabase/supabase-js": "2.39.3",
82 | "@trpc/client": "10.45.2",
83 | "@trpc/server": "10.45.2",
84 | "daisyui": "^4.10.2",
85 | "drizzle-orm": "^0.30.9",
86 | "felte": "^1.2.14",
87 | "postgres": "^3.4.4",
88 | "superjson": "^2.2.1",
89 | "trpc-sveltekit": "^3.6.1",
90 | "zod": "^3.23.3"
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/routes/payment-example/+page.svelte:
--------------------------------------------------------------------------------
1 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | {#if stripe && clientSecret}
74 |
80 |
81 |
111 |
112 | {:else}
113 | Loading...
114 | {/if}
115 |
--------------------------------------------------------------------------------
/src/routes/posts-example/+page.svelte:
--------------------------------------------------------------------------------
1 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | {#if error}
92 |
{error}
93 | {/if}
94 | {#each posts as post}
95 |
96 |
{post.id}
97 |
{post.title}
98 |
{post.content}
99 |
{post.authorId}
100 |
120 |
121 | {/each}
122 | {#if loading}
123 |
Loading...
124 | {/if}
125 |
126 |
135 |
136 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | A svelte fullstack starter kit heavily inspired by create-t3-app with various added bonuses
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | ## 📚 The Kit Stack
25 |
26 | | | |
27 | |--|--|
28 | | 🛠️ **SvelteKit**: Fullstack Framework | 🔐 **Supabase Auth**: Authentication |
29 | | 🗃️ **Drizzle**: Database ORM | 🧹 **tRPC**: Typesafe API Calls |
30 | | 🎨 **DaisyUI**: Component Library | 🖌 **Storybook**: UI Testing Tool |
31 | | 💳 **Stripe**: Payments API | 📚 **Inlang**: Internationalization Library |
32 | | 📝 **Felte**: Form Validation | 📃 **Prettier & ESLint**: Code Formatting |
33 | | 🤖 **Vercel**: Deploy with CI | 🍞 **Bun**: Fast Package Manager |
34 | | | |
35 |
36 | ## 🔌 Features
37 |
38 | - **Authentication**: Sign up, sign in, sign out, forgot password, change password, change email, change username, delete account
39 |
40 | - **Authorization**: Protected routes, protected pages, protected endpoints
41 |
42 | - **Database**: CRUD operations, relations, migrations
43 |
44 | - **Payments**: Stripe integration
45 |
46 | - **UI**: Design system, component library, UI testing, icons and fonts
47 |
48 | - **Forms**: Form validation, form submission, form errors
49 |
50 | - **Internationalization**: Multiple language integration
51 |
52 | - **Deployment**: Easy and fast deployments with CI including database migrations
53 |
54 | ## Getting Started
55 |
56 | You can browse the [Github Wiki](https://github.com/albbus-stack/kit-stack/wiki) to get a better idea of how this works or you can jump right in using the [Install Script](https://github.com/albbus-stack/kit-stack/wiki/Install-Script):
57 |
58 | ```bash
59 | curl -sL https://tinyurl.com/kit-stack | bash -e -s ""
60 | ```
61 |
62 | The easiest and fastest way is to use a VSCode cloud instance like Gitpod or Github Codespaces, with them you can open the template directly and all the configurations are already handled, but I highly recommend you create your own repo first locally:
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/src/lib/components/LoginForm.svelte:
--------------------------------------------------------------------------------
1 |
91 |
92 |
93 |
{title}
94 | {#if type !== 'signout'}
95 |
125 | {:else}
126 |
Sign out
127 | {/if}
128 |
129 |
130 | User: {user}
131 |
--------------------------------------------------------------------------------
/static/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------