π View Production Build at https://phonebook-doctorderek.vercel.app/
This is a simple phonebook app that supports CRUD operations (create, read, update, delete).
The app provides a form where you can enter a name and phone number for each phonebook entry.
Below you will find the complete feature set, a discussion section, and my technical journal.
- β TypeScript
- β React
- β React Context
- β React Query
- β XState state machines used instead
- β Material UI
- β Tailwind CSS used instead
- β Apollo GraphQL
- β XState with TypeScript used instead
- β Database of your choice
- β
localStorage
used instead
- β
- β Docker Compose
- β Next.js + Vercel used instead
- β Used Next.js version 13.0.0 with React 18.2.0 and Tailwind CSS 3.2.1.
- β Deployed production build of Next.js to Vercel with CI/CD.
- β
Established engineering best practices:
- Prettier, ESLint, Husky (Git Hooks),
tsconfig.json
, TypeScript Import Sorter, XState
- Prettier, ESLint, Husky (Git Hooks),
- β Implemented XState finite state machine to handle application state.
- β Matched design document with READ and search by last name functionality.
- β Built accessible dialog (modal) using Headless UI and Tailwind CSS.
- β Added various tooltips that appear on hover to improve user experience.
- β Enabled CREATE, UPDATE, DELETE, and RESET actions using React Hook Form.
- β Sorted data by last name for a consistent user experience in the app.
- π Add unit test coverage for entire app with Jest & React Testing Library.
- XState takes the place of React Query in the app. The benefit of XState is the finite set of states, without additional testing.
- It would be easy to connect any database without affecting the frontend by simplying replacing the
localStorage
calls in XState. - The app isn't particularly well-suited to GraphQL given the CRUD model, simplistic data objects, and extremely small data size.
- We don't handle phone validation at all, but we would probably want some type of validation in production, as long as it's reliable.
- The entire codebase could use extensive refactoring, since everything is simply built in the homepage (
@/pages/index.tsx
). - The app is difficult to test with React Testing Library without refactoring, because everything is closely coupled with XState.
- Docker is unnecessary for this project, and I find it almost always reduces the performance of Next.js vs. deploying at Vercel.
- Material UI has some benefits, but it can be hard to customize unless the designer uses it, while Tailwind is very easy to use.
- See https://github.com/DoctorDerek/calendar-appointments for an example from my portfolio using Material UI in depth.
- Like with many projects, the design document left out certain features: RESET, dialogs (modals), hover styles, and animations.
- Because of the combination of
localStorage
with XState, we have auto-save functionality that supports refreshing the page.
0.1.1
New app: create next-app w/TypeScript + Yarn 30.2.0
Added all best practices & basic dependencies0.3.0
Create XState finite state machine for app0.4.0
Add initial (default) values and RESET action0.5.0
Implement design of app from design document0.6.0
Build out the search filter and DELETE action0.7.0
Make the dialog (modal) to handle CRUD actions0.8.0
Use React Hook Form to handle dialog actions0.9.0
Enable CREATE, UPDATE, DELETE, RESET actions0.9.1
Finish the discussion section in theREADME.md
1.0.0
Upload photos and migrate to Next 13's@/app