36 |
37 | );
38 | }
39 |
40 | export default App;
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## AWS Amplify React+Vite Starter Template
2 |
3 | This repository provides a starter template for creating applications using React+Vite and AWS Amplify, emphasizing easy setup for authentication, API, and database capabilities.
4 |
5 | ## Overview
6 |
7 | This template equips you with a foundational React application integrated with AWS Amplify, streamlined for scalability and performance. It is ideal for developers looking to jumpstart their project with pre-configured AWS services like Cognito, AppSync, and DynamoDB.
8 |
9 | ## Features
10 |
11 | - **Authentication**: Setup with Amazon Cognito for secure user authentication.
12 | - **API**: Ready-to-use GraphQL endpoint with AWS AppSync.
13 | - **Database**: Real-time database powered by Amazon DynamoDB.
14 |
15 | ## Deploying to AWS
16 |
17 | For detailed instructions on deploying your application, refer to the [deployment section](https://docs.amplify.aws/react/start/quickstart/#deploy-a-fullstack-app-to-aws) of our documentation.
18 |
19 | ## Security
20 |
21 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
22 |
23 | ## License
24 |
25 | This library is licensed under the MIT-0 License. See the LICENSE file.
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | background: linear-gradient(180deg, rgb(117, 81, 194), rgb(255, 255, 255));
4 | display: flex;
5 | font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
6 | height: 100vh;
7 | width: 100vw;
8 | justify-content: center;
9 | align-items: center;
10 | }
11 |
12 | main {
13 | display: flex;
14 | flex-direction: column;
15 | align-items: stretch;
16 | }
17 |
18 | button {
19 | border-radius: 8px;
20 | border: 1px solid transparent;
21 | padding: 0.6em 1.2em;
22 | font-size: 1em;
23 | font-weight: 500;
24 | font-family: inherit;
25 | background-color: #1a1a1a;
26 | cursor: pointer;
27 | transition: border-color 0.25s;
28 | color: white;
29 | }
30 | button:hover {
31 | border-color: #646cff;
32 | }
33 | button:focus,
34 | button:focus-visible {
35 | outline: 4px auto -webkit-focus-ring-color;
36 | }
37 |
38 | ul {
39 | padding-inline-start: 0;
40 | margin-block-start: 0;
41 | margin-block-end: 0;
42 | list-style-type: none;
43 | display: flex;
44 | flex-direction: column;
45 | margin: 8px 0;
46 | border: 1px solid black;
47 | gap: 1px;
48 | background-color: black;
49 | border-radius: 8px;
50 | overflow: auto;
51 | }
52 |
53 | li {
54 | background-color: white;
55 | padding: 8px;
56 | }
57 |
58 | li:hover {
59 | background: #dadbf9;
60 | }
61 |
62 | a {
63 | font-weight: 800;
64 | text-decoration: none;
65 | }
--------------------------------------------------------------------------------
/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/amplify/data/resource.ts:
--------------------------------------------------------------------------------
1 | import { type ClientSchema, a, defineData } from "@aws-amplify/backend";
2 |
3 | /*== STEP 1 ===============================================================
4 | The section below creates a Todo database table with a "content" field. Try
5 | adding a new "isDone" field as a boolean. The authorization rule below
6 | specifies that any user authenticated via an API key can "create", "read",
7 | "update", and "delete" any "Todo" records.
8 | =========================================================================*/
9 | const schema = a.schema({
10 | Todo: a
11 | .model({
12 | content: a.string(),
13 | })
14 | .authorization((allow) => [allow.publicApiKey()]),
15 | });
16 |
17 | export type Schema = ClientSchema;
18 |
19 | export const data = defineData({
20 | schema,
21 | authorizationModes: {
22 | defaultAuthorizationMode: "apiKey",
23 | // API Key is used for a.allow.public() rules
24 | apiKeyAuthorizationMode: {
25 | expiresInDays: 30,
26 | },
27 | },
28 | });
29 |
30 | /*== STEP 2 ===============================================================
31 | Go to your frontend source code. From your client-side code, generate a
32 | Data client to make CRUDL requests to your table. (THIS SNIPPET WILL ONLY
33 | WORK IN THE FRONTEND CODE FILE.)
34 |
35 | Using JavaScript or Next.js React Server Components, Middleware, Server
36 | Actions or Pages Router? Review how to generate Data clients for those use
37 | cases: https://docs.amplify.aws/gen2/build-a-backend/data/connect-to-API/
38 | =========================================================================*/
39 |
40 | /*
41 | "use client"
42 | import { generateClient } from "aws-amplify/data";
43 | import type { Schema } from "@/amplify/data/resource";
44 |
45 | const client = generateClient() // use this Data client for CRUDL requests
46 | */
47 |
48 | /*== STEP 3 ===============================================================
49 | Fetch records from the database and use them in your frontend component.
50 | (THIS SNIPPET WILL ONLY WORK IN THE FRONTEND CODE FILE.)
51 | =========================================================================*/
52 |
53 | /* For example, in a React component, you can use this snippet in your
54 | function's RETURN statement */
55 | // const { data: todos } = await client.models.Todo.list()
56 |
57 | // return
{todos.map(todo =>
{todo.content}
)}
58 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4 | documentation, we greatly value feedback and contributions from our community.
5 |
6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7 | information to effectively respond to your bug report or contribution.
8 |
9 |
10 | ## Reporting Bugs/Feature Requests
11 |
12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13 |
14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16 |
17 | * A reproducible test case or series of steps
18 | * The version of our code being used
19 | * Any modifications you've made relevant to the bug
20 | * Anything unusual about your environment or deployment
21 |
22 |
23 | ## Contributing via Pull Requests
24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
25 |
26 | 1. You are working against the latest source on the *main* branch.
27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
29 |
30 | To send us a pull request, please:
31 |
32 | 1. Fork the repository.
33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34 | 3. Ensure local tests pass.
35 | 4. Commit to your fork using clear commit messages.
36 | 5. Send us a pull request, answering any default questions in the pull request interface.
37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
38 |
39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41 |
42 |
43 | ## Finding contributions to work on
44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
45 |
46 |
47 | ## Code of Conduct
48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
50 | opensource-codeofconduct@amazon.com with any additional questions or comments.
51 |
52 |
53 | ## Security issue notifications
54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
55 |
56 |
57 | ## Licensing
58 |
59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
60 |
--------------------------------------------------------------------------------
/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------