Skip to content
Merged
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
41 changes: 41 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependencies and Build
node_modules
dist
dist-ssr
*.local
coverage
build

# Editor directories and IDEs
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.vscode

# dotenv environment variable files
.env
.env.*
.env.local

# CI & Testing
.github
src/tests
**/*.test.tsx
**/*.test.ts

# Temp
.temp
.tmp
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules
dist
dist-ssr
*.local
coverage
build

# Editor directories and files
.idea
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# --- STAGE 1: Build ---
# We use a lightweight Node image to build the app
FROM node:25-alpine3.19 AS builder

WORKDIR /app

# 1. We copy the dependency files to leverage Docker's caching
COPY package*.json ./
RUN npm install

# 2. We copy the rest of the project files
COPY . .

# 3. We run the build (this uses the tsconfig.json we already fixed)
RUN npm run build

# --- STAGE 2: Production ---
FROM nginx:1.27.11-alpine3.21

# Update OS packages to reduce known vulnerabilities at build time
RUN apk update && apk upgrade --no-cache && rm -rf /var/cache/apk/*

# 4. We copy only the built files (dist) from the previous stage
# This makes the final image extremely small (approx 20-40MB)
COPY --from=builder /app/dist /usr/share/nginx/html

# 5. We expose port 80
EXPOSE 80

# 6. We start Nginx
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
globalIgnores(['dist', 'node_modules', 'build', 'coverage']),
{
files: ['**/*.{ts,tsx}'],
extends: [
Expand Down
158 changes: 153 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@types/react-dom": "^19.2.3",
"@types/testing-library__jest-dom": "^5.14.9",
"@vitejs/plugin-react": "^6.0.1",
"@vitest/coverage-v8": "^4.1.5",
"autoprefixer": "^10.4.27",
"eslint": "^9.39.4",
"eslint-plugin-react-hooks": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app/providers/AuthProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { useAuthStore } from '@/features/auth/store/authStore';
import { useAuthStore } from '@/features/auth';

export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
const checkAuth = useAuthStore((s) => s.actions.checkAuth); // A function that checks the token in localStorage/cookies
Expand Down
2 changes: 2 additions & 0 deletions src/app/providers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './AuthProvider';
export * from './MainProvider';
8 changes: 4 additions & 4 deletions src/app/routes/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createBrowserRouter } from 'react-router-dom';
import { ProtectedGuard, PublicGuard } from './RouteGuards';
import { lazyImport } from '@/shared/utils/LazyImport';
import { lazyImport } from '@/shared/utils';

// Pages
const LoginPage = lazyImport(() => import('@/features/auth/pages/LoginPage'), 'LoginPage');
const RegisterPage = lazyImport(() => import('@/features/auth/pages/RegisterPage'), 'RegisterPage');
const DashboardPage = lazyImport(() => import('@/features/tasks/pages/DashboardPage'), 'DashboardPage');
const LoginPage = lazyImport(() => import('@/features/auth'), 'LoginPage');
const RegisterPage = lazyImport(() => import('@/features/auth'), 'RegisterPage');
const DashboardPage = lazyImport(() => import('@/features/tasks'), 'DashboardPage');

export const router = createBrowserRouter([
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/routes/RouteGuards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Navigate, Outlet } from 'react-router-dom';
import { useAuthStore } from '@/features/auth/store/authStore';
import { useAuthStore } from '@/features/auth';

export const ProtectedGuard = () => {
const isAuth = useAuthStore(s => s.isAuthenticated);
Expand Down
Loading
Loading