Vzdělávejte se mimo lavice. Nechte se provést atraktivními lokacemi, vyřešte mnoho výzev a objevte nejednu geografickou zajímavost s bezplatnou mobilní aplikací.
Go to file
Ludvík Prokopec ae91149a67 big update 2022-12-03 10:30:26 +01:00
.vscode init 2022-12-01 12:25:45 +01:00
public init 2022-12-01 12:25:45 +01:00
src big update 2022-12-03 10:30:26 +01:00
.editorconfig init 2022-12-01 12:25:45 +01:00
.gitignore do not include appwrite folder 2022-12-02 17:49:10 +01:00
.prettierrc init 2022-12-01 12:25:45 +01:00
LICENSE init 2022-12-01 12:25:45 +01:00
README.md big update 2022-12-03 10:30:26 +01:00
index.html init 2022-12-01 12:25:45 +01:00
jsconfig.json init 2022-12-01 12:25:45 +01:00
package-lock.json add languages, bug fixes 2022-12-02 19:26:41 +01:00
package.json add languages, bug fixes 2022-12-02 19:26:41 +01:00
postcss.config.cjs init 2022-12-01 12:25:45 +01:00
tailwind.config.cjs big update 2022-12-03 10:30:26 +01:00
tsconfig.json add languages, bug fixes 2022-12-02 19:26:41 +01:00
vite.config.js init 2022-12-01 12:25:45 +01:00

README.md

Svelte + Appwrite = 🚀

Blazing fast development with done backend and fully-prepared frontend.

Appwrite installation

Appwrite installation

Frontend included

  • tailwind
  • scss
  • css reset
  • typescript
  • routing
  • ready routes
  • oauth
  • folder structure
  • common components
  • simple icons
  • service worker
  • path aliases
  • database realtime subscribers
  • i18n
  • vite
  • prettier
  • editorconfig

Database subscribers

<script>
  import CollectionSubscriber from '$lib/database'
  import Layout from '$lib/components/Layout'
  import { Query } from 'appwrite'

  const collection = new Collection('[database-id]', '[collection-id]')
  const [subscriber, loading, insertSubscriber] = collection.subscribe([Query.limit(5)])
  // listen changes in database and automatically rerender on change
  // current data = [{ name: 'John', lastName: 'Doe' }, ...]
</script>

<Layout>
  {#if $loading}
    <p>Loading...</p>
  {:else}
    {#each [...$subscriber, ...$insertSubscriber] as item}
      <p>{item.name}</p>
    {/each}
  {/if}
</Layout>

Routing

<script>
  import { Router, Route, ProtectedRoute, Redirect, navigate, link, back, forward } from '$lib/router'
  import Home from './routes/home.svelte'
  import Profile from './routes/profile.svelte'
  import { isLoading, user, logout } from '$lib/auth'
</script>

<main>
  {#if !$isLoading}
    <Router>
      <Route path="/" component={Home}>
      <ProtectedRoute path="/profile" allow={$user?.status} fallback="/" component={Profile}>

      <a href="/about" use:link>About us</a>
    </Router>
  {/if}
</main>

Social auth icons

<script>
  import { Github } from '@icons-pack/svelte-simple-icons'
  import Layout from '$lib/components/Layout'
  import { account, url } from '$lib/stores/appwrite'
</script>

<Layout>
  <button on:click={() => account.createOAuth2Session('github', url.oauth.success, url.oauth.failure)}>
    <Github />
  </button>
</Layout>

i18n

Locale file src/locales/en.json

{
  "page": {
    "home": {
      "title": "Homepage"
    }
  }
}
<script>
  import Layout from '$lib/components/Layout'
  import { _, locale, locales } from 'svelte-i18n'
</script>

<Layout>
  <h1>{$_('page.home.title')}</h1>

  <div>
    <p>Change language:</p>

    <select bind:value={$locale}>
      {#each $locales as locale}
        <option value={locale}>{locale}</option>
      {/each}
    </select>
  </div>
</Layout>

path aliases

$lib = src/lib $root = / $src = src