Skip to content

Commit bc998c7

Browse files
authored
Merge pull request #9 from Vbsof/refator/nextjs-to-vite-react
refactor: NextJS to vite/react-router
2 parents 02a3729 + de91f4d commit bc998c7

47 files changed

Lines changed: 4446 additions & 3988 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
node_modules/
33
.git/
44
frontend/node_modules/
5-
frontend/.next/
65
frontend/dist/
76
infra-cdk/node_modules/
87
infra-cdk/cdk.out/

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ notebooks/examples/data
2525
**/cdk.out
2626
**/.envrc
2727
**/node_modules
28-
**/.next
29-
**/next-env.d.ts
28+
**/.vite
3029
frontend/public/aws-exports.json
3130
.venv
3231
scripts/zip-artifact/

.kics.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ exclude-paths:
77
- "node_modules/"
88
- ".git/"
99
- ".ruff_cache/"
10-
- "frontend/.next/"
1110
- "infra-cdk/cdk.out/"
1211
- "public/"
1312
- "*.pyc"

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ All notable changes to the Fullstack AgentCore Solution Template (FAST) will be
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.1] - 2026-02-02
9+
10+
### Added
11+
- Vite as build tool with optimized development server and production builds
12+
- React Router (react-router-dom v6) for client-side routing
13+
- Comprehensive test suite with unit tests and property-based tests using Vitest
14+
- New application entry points: `main.tsx`, `App.tsx`, and route components
15+
- Vite configuration with code splitting and optimized chunk strategy
16+
- TypeScript configuration optimized for Vite bundler
17+
- Environment variable type definitions for Vite (`vite-env.d.ts`)
18+
19+
### Changed
20+
- Migrated frontend from Next.js 16 (App Router) to Vite + React + React Router stack
21+
- Replaced Next.js build system with Vite for faster builds and simpler configuration
22+
- Updated environment variable prefix from `NEXT_PUBLIC_*` to `VITE_*`
23+
- Migrated environment variable access from `process.env` to `import.meta.env`
24+
- Restructured application entry points from Next.js layout/page pattern to explicit React rendering
25+
- Moved global styles from `app/globals.css` to `src/styles/globals.css`
26+
- Updated npm scripts: `dev` now runs Vite, `build` runs TypeScript check + Vite build
27+
- Updated ESLint configuration to remove Next.js-specific rules
28+
- Updated frontend README with Vite-specific instructions and development workflow
29+
30+
### Removed
31+
- Next.js framework and dependencies (`next`, `eslint-config-next`)
32+
- Next.js configuration file (`next.config.ts`)
33+
- Next.js App Router file structure (`app/layout.tsx`, `app/page.tsx`)
34+
- Next.js-specific build artifacts and references
35+
836
## [0.3.0] - 2026-01-15
937

1038
### Changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ This section describes how _FAST contributors_ should get started. If you are a
7676
Familiarize yourself with the project structure:
7777

7878
- `docs/`: Documentation files
79-
- `frontend/`: Web UI components (React/Next.js)
79+
- `frontend/`: Web UI components (React)
8080
- `gateway/`: Shared utilities and tools for AgentCore Gateway integration
8181
- `infra-cdk/`: Infrastructure as Code (CDK)
8282
- `patterns/`: Implementation of Agentic patterns to be deployed into AgentCore

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The out-of-the-box architecture is shown above. Note that Amazon Cognito is used
6060

6161
### Tech Stack
6262

63-
- **Frontend**: React with Next.js, TypeScript, Tailwind CSS, and shadcn components - infinitely flexible and ready for coding assistants
63+
- **Frontend**: React with TypeScript, Vite, Tailwind CSS, and shadcn components - infinitely flexible and ready for coding assistants
6464
- **Agent Providers**: Multiple agent providers supported (Strands, LangGraph, etc.) running within AgentCore Runtime
6565
- **Authentication**: AWS Cognito User Pool with OAuth support for easy swapping out Cognito
6666
- **Infrastructure**: CDK deployment with Amplify Hosting for frontend and AgentCore backend
@@ -69,9 +69,9 @@ The out-of-the-box architecture is shown above. Note that Amazon Cognito is used
6969

7070
```
7171
fullstack-agentcore-solution-template/
72-
├── frontend/ # Next.js React frontend application
72+
├── frontend/ # React frontend application
7373
│ ├── src/
74-
│ │ ├── app/ # Next.js app router pages
74+
│ │ ├── app/ # app router pages
7575
│ │ ├── components/ # React components (shadcn/ui)
7676
│ │ ├── hooks/ # Custom React hooks
7777
│ │ ├── lib/ # Utility libraries

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.3.1

docs/DEPLOYMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ This script automatically:
123123

124124
- Generates fresh `aws-exports.json` from CDK stack outputs (see below for more information about `aws-exports.json`)
125125
- Installs/updates npm dependencies if needed
126-
- Builds the Next.js frontend
126+
- Builds the frontend
127127
- Deploys to AWS Amplify Hosting
128128

129129
You will see the URL for application in the script's output, which will look similar to this:

frontend/README.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Frontend - Local Development Guide
22

3-
This is the React/Next.js frontend for the Fullstack AgentCore Solution Template (FAST). This README focuses on local development setup and workflows.
3+
This is the React + Vite frontend for the Fullstack AgentCore Solution Template (FAST). This README focuses on local development setup and workflows.
44

55
For full stack deployment instructions, see the [top-level README](../README.md) and [deployment documentation](../docs/DEPLOYMENT.md).
66

@@ -45,38 +45,38 @@ By default, the app uses Cognito authentication. To test this locally:
4545
2. Set the redirect URI for local development:
4646

4747
```bash
48-
export NEXT_PUBLIC_COGNITO_REDIRECT_URI=http://localhost:3000
48+
export VITE_COGNITO_REDIRECT_URI=http://localhost:3000
4949
npm run dev
5050
```
5151

5252
### Option 2: Disable Authentication (ONLY for Local Development!!!)
5353

5454
For faster local development without needing to deploy Cognito, you can disable authentication:
5555

56-
**⚠️ IMPORTANT: Remove the AuthProvider wrapper from `src/app/layout.tsx`**
56+
**⚠️ IMPORTANT: Remove the AuthProvider wrapper from `src/App.tsx`**
5757

5858
Change this:
5959

6060
```tsx
61-
export default function RootLayout({ children }: { children: React.ReactNode }) {
61+
export default function App() {
6262
return (
63-
<html lang="en">
64-
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
65-
<AuthProvider>{children}</AuthProvider>
66-
</body>
67-
</html>
63+
<BrowserRouter>
64+
<AuthProvider>
65+
<AppRoutes />
66+
</AuthProvider>
67+
</BrowserRouter>
6868
)
6969
}
7070
```
7171

7272
To this:
7373

7474
```tsx
75-
export default function RootLayout({ children }: { children: React.ReactNode }) {
75+
export default function App() {
7676
return (
77-
<html lang="en">
78-
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
79-
</html>
77+
<BrowserRouter>
78+
<AppRoutes />
79+
</BrowserRouter>
8080
)
8181
}
8282
```
@@ -139,22 +139,47 @@ Popular icons include Camera, Search, Menu, User, Settings, Download, Upload, an
139139
```
140140
frontend/
141141
├── src/
142-
│ ├── app/ # Next.js app router
142+
│ ├── main.tsx # Application entry point
143+
│ ├── App.tsx # Root component with routing
144+
│ ├── routes/ # Route components
143145
│ ├── components/
144146
│ │ ├── ui/ # shadcn components
145147
│ │ └── auth/ # Authentication components
146148
│ ├── lib/ # Utilities and configurations
147-
│ └── services/ # API service layers
149+
│ ├── services/ # API service layers
150+
│ └── styles/ # Global styles
148151
├── public/ # Static assets
152+
├── index.html # HTML entry point
149153
└── package.json
150154
```
151155

156+
## Environment Variables
157+
158+
The application uses Vite environment variables with the `VITE_` prefix:
159+
160+
- `VITE_COGNITO_USER_POOL_ID` - Cognito User Pool ID
161+
- `VITE_COGNITO_CLIENT_ID` - Cognito Client ID
162+
- `VITE_COGNITO_REGION` - AWS Region
163+
- `VITE_COGNITO_REDIRECT_URI` - Redirect URI after authentication
164+
- `VITE_COGNITO_POST_LOGOUT_REDIRECT_URI` - Redirect URI after logout
165+
166+
These can be set in a `.env` file or as environment variables. The application will fall back to `aws-exports.json` if environment variables are not set.
167+
168+
## Available Scripts
169+
170+
- `npm run dev` - Start the Vite development server
171+
- `npm run build` - Build for production (runs TypeScript check + Vite build)
172+
- `npm run preview` - Preview the production build locally
173+
- `npm run lint` - Run ESLint
174+
- `npm run lint:fix` - Run ESLint with auto-fix
175+
- `npm run clean` - Clean build artifacts and dependencies
176+
152177
## Development Tips
153178

154-
- **Hot Reload**: Changes auto-reload in the browser
155-
- **TypeScript**: Full type safety with AI assistant support
156-
- **Tailwind CSS**: Utility-first styling
179+
- **Hot Reload**: Changes auto-reload in the browser with Vite's fast HMR
180+
- **TypeScript**: Full type safety with strict mode enabled
157181
- **Vibe Coding**: Optimized for AI-assisted development
182+
- **Tailwind CSS**: Utility-first styling with Tailwind CSS 4
158183

159184
## Building with AI Assistants
160185

frontend/eslint.config.mjs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
import { dirname } from "path"
22
import { fileURLToPath } from "url"
3-
import { FlatCompat } from "@eslint/eslintrc"
43

54
const __filename = fileURLToPath(import.meta.url)
65
const __dirname = dirname(__filename)
76

8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
})
11-
127
const eslintConfig = [
13-
// Ignore patterns (replacing .eslintignore)
14-
{
15-
ignores: ["node_modules/**", "build/**", "delete/**", "tmp/**", ".next/**"],
16-
},
17-
...compat.extends("next/core-web-vitals", "next/typescript"),
8+
// Ignore patterns
189
{
1910
rules: {
2011
// Treat these as warnings instead of errors to prevent build failures
2112
"@typescript-eslint/no-explicit-any": "warn",
2213
"@typescript-eslint/no-unused-vars": "warn",
2314
},
15+
ignores: ["node_modules/**", "build/**", "delete/**", "tmp/**", ".vite/**", "src/app/**"],
2416
},
2517
]
2618

2719
export default eslintConfig
20+
21+

0 commit comments

Comments
 (0)