generated from chiubaca/fullstack-astro-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e72741a
Showing
31 changed files
with
13,394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# build output | ||
dist/ | ||
# generated types | ||
.astro/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store | ||
|
||
# jetbrains setting folder | ||
.idea/ | ||
|
||
# cloudflare | ||
.wrangler | ||
.dev.vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"recommendations": ["astro-build.astro-vscode"], | ||
"unwantedRecommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"command": "./node_modules/.bin/astro dev", | ||
"name": "Development server", | ||
"request": "launch", | ||
"type": "node-terminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Astro Starter Kit: Minimal | ||
|
||
```sh | ||
npm create astro@latest -- --template minimal | ||
``` | ||
|
||
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal) | ||
[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/minimal) | ||
[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/minimal/devcontainer.json) | ||
|
||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! | ||
## 🚀 Project Structure | ||
|
||
Inside of your Astro project, you'll see the following folders and files: | ||
|
||
```text | ||
/ | ||
├── public/ | ||
├── src/ | ||
│ └── pages/ | ||
│ └── index.astro | ||
└── package.json | ||
``` | ||
|
||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. | ||
|
||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. | ||
|
||
Any static assets, like images, can be placed in the `public/` directory. | ||
|
||
## 🧞 Commands | ||
|
||
All commands are run from the root of the project, from a terminal: | ||
|
||
| Command | Action | | ||
| :------------------------ | :----------------------------------------------- | | ||
| `npm install` | Installs dependencies | | ||
| `npm run dev` | Starts local dev server at `localhost:4321` | | ||
| `npm run build` | Build your production site to `./dist/` | | ||
| `npm run preview` | Preview your build locally, before deploying | | ||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | ||
| `npm run astro -- --help` | Get help using the Astro CLI | | ||
|
||
## 👀 Want to learn more? | ||
|
||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineConfig } from "astro/config"; | ||
import react from "@astrojs/react"; | ||
|
||
import cloudflare from "@astrojs/cloudflare"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
integrations: [react()], | ||
output: "server", | ||
vite: { | ||
ssr: { | ||
external: ["node:async_hooks"], | ||
}, | ||
}, | ||
adapter: cloudflare({ | ||
platformProxy: { | ||
enabled: true, | ||
} | ||
}), | ||
experimental: { | ||
actions: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { sql } from "drizzle-orm"; | ||
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"; | ||
|
||
export const message = sqliteTable("message", { | ||
id: integer("id").primaryKey(), | ||
userId: text("user_id") | ||
.notNull() | ||
.references(() => userTable.id), | ||
text: text("text").notNull(), | ||
createdAt: text("timestamp") | ||
.notNull() | ||
.default(sql`(current_timestamp)`), | ||
imageRef: text("image_ref").unique(), | ||
}); | ||
|
||
export const userTable = sqliteTable("user", { | ||
id: text("id").notNull().primaryKey(), | ||
oauthId: text("oauth_id", { length: 255 }).unique().notNull(), | ||
authType: text("oauth_type", { enum: ["google", "github"] }).notNull(), | ||
avatarUrl: text("avatar_url"), | ||
userName: text("user_name").notNull(), // The user alias or handle name | ||
fullName: text("full_name").notNull(), // Full name of the user | ||
email: text("email").notNull(), | ||
createdAt: text("timestamp") | ||
.notNull() | ||
.default(sql`(current_timestamp)`), | ||
}); | ||
|
||
export const sessionTable = sqliteTable("session", { | ||
id: text("id").notNull().primaryKey(), | ||
userId: text("user_id") | ||
.notNull() | ||
.references(() => userTable.id), | ||
expiresAt: integer("expires_at").notNull(), | ||
createdAt: text("timestamp") | ||
.notNull() | ||
.default(sql`(current_timestamp)`), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from "drizzle-kit"; | ||
|
||
const config = defineConfig({ | ||
schema: "./db/schema.ts", | ||
dialect: "sqlite", | ||
verbose: true, | ||
strict: true, | ||
driver: "d1-http", | ||
// dbCredentials:{ | ||
// wranglerConfigPath: "./wrangler.toml", | ||
// dbName: 'fullstack-astro-cloudflare-db' | ||
// }, | ||
dbCredentials: { | ||
accountId: "6fba426cae95d09cbd43f7d359f87924", | ||
databaseId: "307c117f-ab77-485c-a26e-deb8586cbd3b", | ||
token: "T8xfT6Gppkkd2UXC7g_qVeP3im6ajLQs3rJRmT2H", | ||
}, | ||
}); | ||
|
||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE `message` ( | ||
`id` integer PRIMARY KEY NOT NULL, | ||
`user_id` text NOT NULL, | ||
`text` text NOT NULL, | ||
`timestamp` text DEFAULT (current_timestamp) NOT NULL, | ||
`image_ref` text, | ||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `session` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`user_id` text NOT NULL, | ||
`expires_at` integer NOT NULL, | ||
`timestamp` text DEFAULT (current_timestamp) NOT NULL, | ||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `user` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`oauth_id` text(255) NOT NULL, | ||
`oauth_type` text NOT NULL, | ||
`avatar_url` text, | ||
`user_name` text NOT NULL, | ||
`full_name` text NOT NULL, | ||
`email` text NOT NULL, | ||
`timestamp` text DEFAULT (current_timestamp) NOT NULL | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `message_image_ref_unique` ON `message` (`image_ref`);--> statement-breakpoint | ||
CREATE UNIQUE INDEX `user_oauth_id_unique` ON `user` (`oauth_id`); |
Oops, something went wrong.