Skip to content

feat: ssr #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server-side-rendering/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PUBLIC_APPWRITE_ENDPOINT=
PUBLIC_APPWRITE_PROJECT_ID=
APPWRITE_KEY=
24 changes: 24 additions & 0 deletions server-side-rendering/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
75 changes: 75 additions & 0 deletions server-side-rendering/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
13 changes: 13 additions & 0 deletions server-side-rendering/assets/appwrite-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added server-side-rendering/assets/login-dark-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions server-side-rendering/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Models } from "node-appwrite";

declare module "h3" {
interface H3EventContext {
user?: Models.User<Models.Preferences>;
}
}
124 changes: 124 additions & 0 deletions server-side-rendering/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<script setup>
import "@appwrite.io/pink";
import "@appwrite.io/pink-icons";
import LoginDarkMode from "assets/login-dark-mode.png";

useHead({
bodyAttrs: {
class: "theme-dark",
},
});
</script>
<template>
<main class="grid-1-1 is-full-page" id="main">
<section
class="u-flex u-flex-vertical"
:style="{ backgroundImage: `url(${LoginDarkMode})` }"
>
<div class="tag-line is-not-mobile">
<p>Server side rendering<span class="underscore">_</span></p>
</div>
<div class="u-flex u-stretch"></div>
<div class="logo u-flex u-gap-16">
<nuxt-link to="/">
<img
src="~/assets/appwrite-logo-dark.svg"
width="160"
class="u-block"
alt="Appwrite Logo"
/>
</nuxt-link>
</div>
</section>
<section
class="grid-1-1-col-2 u-flex u-main-center u-cross-center _u-padding-16-mobile"
>
<div
class="container u-flex u-flex-vertical u-cross-center u-main-center"
>
<slot></slot>
</div>
</section>
</main>
</template>

<style>
#main section:first-child {
padding-block-start: 2.25rem;
padding-block-end: 2rem;
}

#main section:first-child div {
padding-inline-start: 1rem;
padding-inline-end: 1rem;
padding-block-end: 1rem;
}

#main section:first-child .tag-line {
font-size: 4rem;
font-style: normal;
font-weight: 400;
line-height: 100%; /* 80px */
letter-spacing: -1.6px;
backdrop-filter: blur(0.5rem);
}

#main section:first-child .tag-line .underscore {
-webkit-text-fill-color: #f02e65;
}

@media (min-width: 768px) {
#main section:first-child {
background: var(--url);
background-repeat: no-repeat;
background-position: top;
background-size: cover;
padding-block-start: 6.25rem;
padding-block-end: 6.875rem;
}

#main section:first-child div {
padding-inline-start: 2.625rem;
padding-inline-end: 2rem;
}
}

@media (min-width: 1199px) {
#main section:first-child div {
padding-inline-start: 5.625rem;
padding-inline-end: 5rem;
}

#main section:first-child .tag-line {
font-size: 5rem;
}
}

.tag-line {
background: linear-gradient(45deg, white, white 60%, #fd376f);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>

<style global>
.with-separators {
display: flex;
align-items: center;
gap: 1rem;
text-transform: uppercase;
width: 100%;
color: var(--separator-text);
--separator-color: hsl(var(--color-neutral-85));
--separator-text: hsl(var(--color-neutral-60));
}

.with-separators:before,
.with-separators:after {
content: "";
flex: 1;
height: 1px;
background: var(--separator-color);
}
</style>
11 changes: 11 additions & 0 deletions server-side-rendering/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
runtimeConfig: {
appwriteKey: process.env.APPWRITE_KEY,
public: {
appwriteEndpoint: process.env.PUBLIC_APPWRITE_ENDPOINT,
appwriteProjectId: process.env.PUBLIC_APPWRITE_PROJECT_ID,
},
},
});
Loading