├── .gitignore
├── README.md
├── app
├── entry.client.tsx
├── entry.server.tsx
├── root.tsx
├── routes
│ ├── 404.tsx
│ └── index.tsx
├── styles
│ ├── global.css
│ └── index.css
└── tsconfig.json
├── backend
├── config.arc
└── index.js
├── package.json
├── preferences.arc
├── public
└── favicon.ico
└── remix.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /backend/build
2 | /public/build/
3 | node_modules/
4 |
5 | /.cache/
6 |
7 | sam.json
8 | sam.yaml
9 | package-lock.json
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Please Don't Use
2 |
3 | > Please use `npm init remix` instead of this starter repo to create a new Remix app.
4 | > This repository was archived on April 29, 2021.
5 |
6 | # Remix Starter for Architect (AWS CloudFormation)
7 |
8 | Welcome to Remix!
9 |
10 | This is a starter repo for using [Remix](https://remix.run) with [Architect](http://arc.codes) (wrapper around AWS CloudFormation).
11 |
12 | ## Development
13 |
14 | When developing your app, you'll need two terminal tabs, one to run Architect's sandbox, and the other to run the Remix development server. In production, however, the Remix development server won't be used because your assets will be built and shipped with the server.
15 |
16 | First, `.npmrc.example` to `.npmrc` and insert the license key you get from [logging in to your dashboard at remix.run](https://remix.run/dashboard).
17 |
18 | > Note: if this is a public repo, you'll probably want to move the line with
19 | > your key into `~/.npmrc` to keep it private.
20 |
21 | Next, install all dependencies using `npm`:
22 |
23 | ```sh
24 | npm install
25 | ```
26 |
27 | Your `@remix-run/*` dependencies will come from the Remix package registry.
28 |
29 | ### Remix Development Server
30 |
31 | Once everything is installed, start the Remix asset server with the following command:
32 |
33 | ```sh
34 | npm run dev
35 | ```
36 |
37 | The dev server automatically rebuilds as your source files change.
38 |
39 | ### Architect Sandbox
40 |
41 | Architect recommends installing their CLI and the AWS sdk globally:
42 |
43 | ```sh
44 | $ npm i -g @architect/architect aws-sdk
45 | ```
46 |
47 | Now start the sandbox:
48 |
49 | ```sh
50 | $ arc sandbox
51 | ```
52 |
53 | You should now be able to visit http://localhost:3333.
54 |
55 | ## Deploying
56 |
57 | First, you'll need to have the AWS CLI installed, [here are the instructions](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html). Then follow the Architect setup instructions: https://arc.codes/docs/en/guides/get-started/detailed-aws-setup.
58 |
59 | Now you're ready to deploy. From the Remix http handler directory, build the app for production:
60 |
61 | ```sh
62 | $ npm run build
63 | ```
64 |
65 | And then from the root of the project, deploy with `arc`.
66 |
67 | ```sh
68 | $ arc deploy
69 | ```
70 |
71 | That's it!
72 |
73 | ## Documentation
74 |
75 | Detailed documentation for Remix [is available at remix.run](https://docs.remix.run).
76 |
--------------------------------------------------------------------------------
/app/entry.client.tsx:
--------------------------------------------------------------------------------
1 | import ReactDOM from "react-dom";
2 | import { RemixBrowser as Remix } from "@remix-run/react";
3 |
4 | ReactDOM.hydrate(
5 | // @types/react-dom says the 2nd argument to ReactDOM.hydrate() must be a
6 | // `Element | DocumentFragment | null` but React 16 allows you to pass the
7 | // `document` object as well. This is a bug in @types/react-dom that we can
8 | // safely ignore for now.
9 | // @ts-ignore
10 | ,
11 | document
12 | );
13 |
--------------------------------------------------------------------------------
/app/entry.server.tsx:
--------------------------------------------------------------------------------
1 | import ReactDOMServer from "react-dom/server";
2 | import { RemixServer as Remix } from "@remix-run/react";
3 | import type { EntryContext } from "@remix-run/node";
4 |
5 | export default function handleRequest(
6 | request: Request,
7 | responseStatusCode: number,
8 | responseHeaders: Headers,
9 | remixContext: EntryContext
10 | ) {
11 | let markup = ReactDOMServer.renderToString(
12 |
13 | );
14 |
15 | return new Response("" + markup, {
16 | status: responseStatusCode,
17 | headers: {
18 | ...Object.fromEntries(responseHeaders),
19 | "Content-Type": "text/html"
20 | }
21 | });
22 | }
23 |
--------------------------------------------------------------------------------
/app/root.tsx:
--------------------------------------------------------------------------------
1 | import type { LinksFunction, LoaderFunction } from "@remix-run/react";
2 | import { Meta, Links, Scripts, useRouteData } from "@remix-run/react";
3 | import { Outlet } from "react-router-dom";
4 |
5 | import stylesUrl from "./styles/global.css";
6 |
7 | export let links: LinksFunction = () => {
8 | return [{ rel: "stylesheet", href: stylesUrl }];
9 | };
10 |
11 | export let loader: LoaderFunction = () => {
12 | return { date: new Date() };
13 | };
14 |
15 | export default function App() {
16 | let data = useRouteData();
17 |
18 | return (
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 | );
35 | }
36 |
37 | export function ErrorBoundary({ error }: { error: Error }) {
38 | return (
39 |
40 |
41 |
42 | Oops!
43 |
44 |
45 |
46 |
App Error
47 |
{error.message}
48 |
49 | Replace this UI with what you want users to see when your app throws
50 | uncaught errors. The file is at app/App.tsx
.
51 |
52 |
53 |
54 |
55 |
56 |
57 | );
58 | }
59 |
--------------------------------------------------------------------------------
/app/routes/404.tsx:
--------------------------------------------------------------------------------
1 | import type { MetaFunction } from "@remix-run/node";
2 |
3 | export let meta: MetaFunction = () => {
4 | return { title: "Ain't nothing here" };
5 | };
6 |
7 | export default function FourOhFour() {
8 | return (
9 |
10 |
404
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/app/routes/index.tsx:
--------------------------------------------------------------------------------
1 | import type {
2 | MetaFunction,
3 | LinksFunction,
4 | LoaderFunction
5 | } from "@remix-run/react";
6 | import { useRouteData } from "@remix-run/react";
7 |
8 | import stylesUrl from "../styles/index.css";
9 |
10 | export let meta: MetaFunction = () => {
11 | return {
12 | title: "Remix Starter",
13 | description: "Welcome to remix!"
14 | };
15 | };
16 |
17 | export let links: LinksFunction = () => {
18 | return [{ rel: "stylesheet", href: stylesUrl }];
19 | };
20 |
21 | export let loader: LoaderFunction = () => {
22 | return { message: "this is awesome 😎" };
23 | };
24 |
25 | export default function Index() {
26 | let data = useRouteData();
27 |
28 | return (
29 |
30 |
Welcome to Remix!
31 |
32 | Check out the docs to get
33 | started.
34 |
35 |
Message from the loader: {data.message}
36 |
37 | );
38 | }
39 |
--------------------------------------------------------------------------------
/app/styles/global.css:
--------------------------------------------------------------------------------
1 | :focus:not(:focus-visible) {
2 | outline: none;
3 | }
4 |
5 | body {
6 | font-family: sans-serif;
7 | }
8 |
9 | footer {
10 | text-align: center;
11 | color: #ccc;
12 | padding-top: 80px;
13 | }
14 |
--------------------------------------------------------------------------------
/app/styles/index.css:
--------------------------------------------------------------------------------
1 | /*
2 | * when the user visits this page, this style will apply, when they leave, it
3 | * will get unloaded, so don't worry so much about conflicting styles between
4 | * pages!
5 | */
6 |
--------------------------------------------------------------------------------
/app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "esModuleInterop": true,
4 | "jsx": "react-jsx",
5 | "moduleResolution": "node",
6 | "target": "es2019",
7 | "strict": true,
8 | "skipLibCheck": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/backend/config.arc:
--------------------------------------------------------------------------------
1 | @aws
2 | # runtime nodejs12.x
3 | # memory 1152
4 | # timeout 30
5 | # concurrency 1
6 |
--------------------------------------------------------------------------------
/backend/index.js:
--------------------------------------------------------------------------------
1 | const { createRequestHandler } = require("@remix-run/architect");
2 | exports.handler = createRequestHandler({
3 | build: require("./build"),
4 | });
5 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "remix-starter-architect",
3 | "private": true,
4 | "version": "1.0.0",
5 | "scripts": {
6 | "clean": "rm -rf backend/build public/build",
7 | "build": "npm run clean && remix build2",
8 | "dev": "remix run2"
9 | },
10 | "arc": {
11 | "app": "app-ns",
12 | "http": {
13 | "/*": {"src": "backend", "method": "any"}
14 | }
15 | },
16 | "dependencies": {
17 | "@architect/functions": "^3.13.3",
18 | "@remix-run/architect": "^0.15.3",
19 | "@remix-run/node": "^0.15.3",
20 | "@remix-run/react": "^0.15.3",
21 | "aws-sdk": "2.796.0",
22 | "react": "^17.0.1",
23 | "react-dom": "^17.0.1",
24 | "react-router-dom": "^6.0.0-beta.0"
25 | },
26 | "devDependencies": {
27 | "@remix-run/dev": "^0.15.3",
28 | "@types/react": "^17.0.0",
29 | "@types/react-dom": "^17.0.0",
30 | "typescript": "^4.1.2"
31 | },
32 | "engines": {
33 | "node": "14"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/preferences.arc:
--------------------------------------------------------------------------------
1 | # The @env pragma is synced (and overwritten) by running arc env
2 | @env
3 | testing
4 | REMIX_ENV development
5 |
6 | staging
7 | REMIX_ENV production
8 |
9 | production
10 | REMIX_ENV production
11 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/remix-run/starter-architect/64ac1f6f719e44c2385fb13c18881214274aee9c/public/favicon.ico
--------------------------------------------------------------------------------
/remix.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | /**
3 | * The path to the `app` directory, relative to remix.config.js. Defaults to
4 | * "app". All code in this directory is part of your app and will be compiled
5 | * by Remix.
6 | *
7 | */
8 | appDirectory: "app",
9 |
10 | /**
11 | * A hook for defining custom routes based on your own file conventions. This
12 | * is not required, but may be useful if you have custom/advanced routing
13 | * requirements.
14 | */
15 | // routes(defineRoutes) {
16 | // return defineRoutes(route => {
17 | // route(
18 | // // The URL path for this route.
19 | // "/pages/one",
20 | // // The path to this route's component file, relative to `appDirectory`.
21 | // "pages/one",
22 | // // Options:
23 | // {
24 | // // The path to this route's data module, relative to `dataDirectory`.
25 | // loader: "...",
26 | // // The path to this route's styles file, relative to `appDirectory`.
27 | // styles: "..."
28 | // }
29 | // );
30 | // });
31 | // },
32 |
33 | /**
34 | * The path to the browser build, relative to remix.config.js. Defaults to
35 | * `public/build`. The browser build contains all public JavaScript and CSS
36 | * files that are created when building your routes.
37 | */
38 | browserBuildDirectory: "./public/build",
39 |
40 | /**
41 | * The URL prefix of the browser build with a trailing slash.
42 | */
43 | publicPath: "/_static/build/",
44 |
45 | /**
46 | * The path to the server build directory, relative to remix.config.js.
47 | * Defaults to `build`. The server build is a collection of JavaScript modules
48 | * that are created from building your routes. They are used on the server to
49 | * generate HTML.
50 | */
51 | serverBuildDirectory: "./backend/build",
52 |
53 | /**
54 | * The port to use when running `remix run`. Defaults to 8002.
55 | */
56 | devServerPort: 3334,
57 | };
58 |
--------------------------------------------------------------------------------