Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ak4zh committed Jun 2, 2023
0 parents commit 8ea37c5
Show file tree
Hide file tree
Showing 81 changed files with 6,026 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres

# SMTP config
FROM_EMAIL=
SMTP_HOST=
SMTP_PORT=
SMTP_SECURE=
SMTP_USER=
SMTP_PASS=
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
30 changes: 30 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vscode*
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Akash Agarwal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SLIDE: SvelteKit + Lucia + i18n using inlang + Drizzle + TailwindCSS using Skeleton

- [Lucia](https://lucia-auth.com/) for authentication
- [inlang](https://inlang.com) for language translation
- [Drizzle ORM](https://orm.drizzle.team/) for database connectivity and type safety
- [Skeleton](https://www.skeleton.dev) for ui elements
- [Lucide](https://lucide.dev) for icons
- [Zod](https://zod.dev)
- [Superforms](https://superforms.vercel.app) to handle form validation and management.

Highly inspired from [Sveltekit Auth Starter](https://github.com/delay/sveltekit-auth-starter) which uses prisma, I wanted one with drizzle ORM and a [BottomBar](https://github.com/delay/sveltekit-auth-starter/pull/10) as I prefer to use bottom bar in mobile views.
9 changes: 9 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";
dotenv.config();

export default {
schema: "./src/lib/server/db/schema.ts",
out: "./migrations",
connectionString: process.env.DATABASE_URL,
} satisfies Config;
26 changes: 26 additions & 0 deletions inlang.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

/**
* @type { import("@inlang/core/config").DefineConfig }
*/
export async function defineConfig(env) {
const { default: jsonPlugin } = await env.$import(
"https://cdn.jsdelivr.net/gh/samuelstroschein/inlang-plugin-json@2/dist/index.js"
)
const { default: sdkPlugin } = await env.$import(
"https://cdn.jsdelivr.net/npm/@inlang/sdk-js-plugin@0.6.3/dist/index.js"
)

return {
referenceLanguage: "en",
plugins: [
jsonPlugin({
pathPattern: "./languages/{language}.json",
}),
sdkPlugin({
languageNegotiation: {
strategies: [{ type: "localStorage" }]
}
}),
],
}
}
36 changes: 36 additions & 0 deletions languages/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"signin": "Anmelden",
"signup": "Registrieren",
"signout": "Abmelden",
"forgotPassword": "Passwort vergessen?",
"contact": "Kontakt",
"privacy": "Datenschutz",
"terms": "Nutzungsbedingungen",
"email": "E-Mail-Adresse",
"password": "Passwort",
"firstName": "Vorname",
"lastName": "Nachname",
"profile": "Profil",
"home": "Startseite",
"dashboard": "Armaturenbrett",
"auth": {
"password": {
"reset": {
"success": {
"emailSent": "Passwort zurücksetzen E-Mail gesendet",
"checkEmail": "Überprüfen Sie Ihr E-Mail-Konto auf einen Link zum Zurücksetzen Ihres Passworts. Wenn er nicht innerhalb weniger Minuten angezeigt wird, überprüfen Sie Ihren Spam-Ordner."
},
"resetProblem": "Problem beim Zurücksetzen des Passworts",
"sendResetEmail": "Passwort-Zurücksetzen-E-Mail senden"
},
"update": {
"success": {
"updated": "Passwort erfolgreich aktualisiert"
},
"changePassword": "Ändern Sie Ihr Passwort",
"passwordProblem": "Problem beim Passwortwechsel",
"updatePassword": "Passwort aktualisieren"
}
}
}
}
37 changes: 37 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"signin": "Sign In",
"signinProblem": "Sign In Problem",
"signup": "Sign Up",
"signout": "Sign Out",
"forgotPassword": "Forgot Password?",
"contact": "Contact",
"privacy": "Privacy",
"terms": "Terms",
"email": "Email Address",
"password": "Password",
"firstName": "First Name",
"lastName": "Last Name",
"profile": "Profile",
"home": "Home",
"dashboard": "Dashboard",
"auth": {
"password": {
"reset": {
"success": {
"emailSent": "Password Reset Email Sent",
"checkEmail": "Check your email account for a link to reset your password. If it doesn’t appear within a few minutes, check your spam folder."
},
"resetProblem": "Reset Password Problem",
"sendResetEmail": "Send Password Reset Email"
},
"update": {
"success": {
"updated": "Password updated successfully"
},
"changePassword": "Change Your Password",
"passwordProblem": "Change Password Problem",
"updatePassword": "Update Password"
}
}
}
}
36 changes: 36 additions & 0 deletions languages/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"signin": "Iniciar sesión",
"signup": "Registrarse",
"signout": "Cerrar sesión",
"forgotPassword": "¿Olvidaste tu contraseña?",
"contact": "Contacto",
"privacy": "Privacidad",
"terms": "Términos",
"email": "Dirección de correo electrónico",
"password": "Contraseña",
"firstName": "Nombre",
"lastName": "Apellido",
"profile": "Perfil",
"home": "Inicio",
"dashboard": "Panel",
"auth": {
"password": {
"reset": {
"success": {
"emailSent": "Correo electrónico de restablecimiento de contraseña enviado",
"checkEmail": "Verifique su cuenta de correo electrónico para obtener un enlace para restablecer su contraseña. Si no aparece en unos minutos, verifique su carpeta de correo no deseado."
},
"resetProblem": "Problema al restablecer la contraseña",
"sendResetEmail": "Enviar correo electrónico de restablecimiento de contraseña"
},
"update": {
"success": {
"updated": "Contraseña actualizada correctamente"
},
"changePassword": "Cambiar contraseña",
"passwordProblem": "Problema al cambiar la contraseña",
"updatePassword": "Actualizar contraseña"
}
}
}
}
41 changes: 41 additions & 0 deletions migrations/0000_overjoyed_phil_sheldon.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CREATE TABLE IF NOT EXISTS "auth_key" (
"id" varchar(255) PRIMARY KEY NOT NULL,
"user_id" uuid NOT NULL,
"primary_key" boolean NOT NULL,
"hashed_password" varchar(255),
"expires" bigint
);

CREATE TABLE IF NOT EXISTS "auth_session" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"user_id" uuid NOT NULL,
"active_expires" bigint NOT NULL,
"idle_expires" bigint NOT NULL
);

CREATE TABLE IF NOT EXISTS "auth_user" (
"id" uuid PRIMARY KEY NOT NULL,
"email" text NOT NULL,
"first_name" text,
"last_name" text,
"role" text DEFAULT 'user' NOT NULL,
"verified" boolean DEFAULT false NOT NULL,
"receive_email" boolean DEFAULT true NOT NULL,
"token" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);

CREATE INDEX IF NOT EXISTS "name_idx" ON "auth_user" ("email");
CREATE INDEX IF NOT EXISTS "token_idx" ON "auth_user" ("token");
DO $$ BEGIN
ALTER TABLE "auth_key" ADD CONSTRAINT "auth_key_user_id_auth_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth_user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

DO $$ BEGIN
ALTER TABLE "auth_session" ADD CONSTRAINT "auth_session_user_id_auth_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth_user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit 8ea37c5

Please sign in to comment.