Skip to content

Set up Frontend and Backend Infrastructure #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AkashSDas opened this issue Jul 1, 2024 · 1 comment · Fixed by #2
Closed

Set up Frontend and Backend Infrastructure #1

AkashSDas opened this issue Jul 1, 2024 · 1 comment · Fixed by #2
Assignees
Labels
backend Changes in backend chore Routine maintenance and project upkeep frontend Changes in frontend

Comments

@AkashSDas
Copy link
Owner

AkashSDas commented Jul 1, 2024

In the backend:

  • set up Express w/ TypeScript
  • add testing w/ Jest, Swagger
  • add Husky
  • add useful middleware like morgan, Express File Upload, and add a logger w/ Winston
  • set up with auth w/ Passport.js for JWT auth and Google OAuth

In the frontend:

  • set up project w/ React, Vite, TypeScript, React Router
  • add Redux toolkit, React Query, React Hook Form, Zod
  • add ChakraUI
  • set up Jest, React Testing Library, and Storybook
@AkashSDas AkashSDas added chore Routine maintenance and project upkeep frontend Changes in frontend backend Changes in backend labels Jul 1, 2024
@AkashSDas AkashSDas self-assigned this Jul 1, 2024
@AkashSDas AkashSDas linked a pull request Jul 4, 2024 that will close this issue
@AkashSDas
Copy link
Owner Author

Set up for frontend and backend has been done in this PR. While setting up the front end, I faced the following issues:

  • Running ChakraCLI was giving an error related to fontsource.
  • Typescript

ChakraCLI and fontsource

When generating theme types using the ChakraCLI else it gives the following error:

Chakra UI CLI  v2.4.1 by Chakra UI
Generate theme typings for autocomplete
✘ [ERROR] No loader is configured for ".woff2" files: node_modules/.pnpm/@[email protected]/node_modules/@fontsource-variable/nunito/files/nunito-latin-wght-normal.woff2
     node_modules/.pnpm/@[email protected]/node_modules/@fontsource-variable/nunito/index.css:47:7:
       47 │   src: url(./files/nunito-latin-wght-normal.woff2) format('woff2-variations');

I've tried using unplugin-fonts/vite but it didn't work. Also, to make ChakraCLI work with ppm I had to install @chakra-ui/styled-system as a dev dependency. chakra-ui/chakra-ui#5919

All of this is done to use ChakraCLI for custom types in colors, ... but it isn't as beneficial as to go and look for the above issues.

Typescript

In some places, Typescript was giving errors. This happened for Redux Toolkit and React Router.

The following issues provide more context on the issue faced:

In place of Redux, the issue was solved by this:

// Here this issue is faced by `useAppDispatch`
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import type * as _Redux from "@reduxjs/toolkit";

export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
export const useAppDispatch = () => useDispatch<AppDispatch>();

The best way to solve this issue is to provide an explicit type hint to the variable for which you're facing this issue. For React Router I created frontend/lib/routes.ts and exported the route variable. For this, I was getting this error, but when I directly used it in App.tsx then I wasn't getting this error. If a variable is exported then this error arises for a few identifiers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Changes in backend chore Routine maintenance and project upkeep frontend Changes in frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant