This project was developed as a technical test for the company Dyshez, using Next.js. It is designed for managing user orders and images, featuring authentication and cloud storage with Supabase.
You can test the application at the following link:
👉 https://dyshez-test.vercel.app/
Use the following credentials to log in:
- Email: supabasetest10@gmail.com
- Password: 123456789
Note: This user already has information stored in the Supabase service, so you can view orders and images without needing to register or upload new data.
- User authentication (registration, login, password recovery and reset)
- Order management: listing, pagination, and sorting of orders
- Image management: upload, preview, and delete user images
- Modern interface with React, CSS Modules, and reusable components
- Form handling with React Hook Form and compatible custom components
- Notifications with react-toastify
- Support for social login (Google and GitHub)
- Route protection via middleware
- Supabase for authentication, database, functions and storage
src/
actions/ # Business logic and Supabase calls
app/ # Next.js routes and pages (app router structure)
components/ # Reusable UI components
context/ # React contexts (e.g., images)
hooks/ # Custom hooks for form logic and data
interfaces/ # TypeScript types and contracts
styles/ # CSS Modules files
utils/ # Utilities and helpers
public/ # Static assets (images, fonts)
-
Clone the repository:
git clone https://github.com/JostynG10/dyshez-test.git cd dyshez-test -
Install the dependencies:
npm install # or yarn install -
Set up the environment variables in
.env(see example in.env.example). -
Start the development server:
npm run dev # or yarn dev -
Open http://localhost:3000 in your browser.
dev: Start the development environmentbuild: Build the application for productionstart: Run the application in production modelint: Run the linter
The project is ready to be deployed on Vercel or any platform compatible with Next.js. Check the official Next.js documentation for more details.
Additionally, you can easily deploy this project using Docker, both for development and production environments. Below are two recommended methods:
You can spin up the application in development or production mode using Docker. Make sure you have Docker and Docker Compose installed.
docker-compose up --buildThis will build the image and start the service on port 3000.
For a secure production environment, you can use the nginx/docker-compose.yml file which includes NGINX as a reverse proxy with SSL certificate support.
Steps:
-
Place your SSL certificates (
certificate.crtandprivate.key) in thenginx/ssl/folder. -
From the
nginx/folder, run:docker-compose up --build
This will start two containers:
- client: Your Next.js application running on port 3000.
- nginx: Reverse proxy on port 443 (SSL), redirecting secure traffic to your application.
Access the application from https://localhost:3000 (you can adjust the port in the nginx/docker-compose.yml file if needed).
Note: Make sure your certificates are valid to avoid browser warnings.
Check the docker-compose.yml and nginx/default.conf files for more configuration details.
This project uses Supabase as a complete backend: authentication, database, functions and storage. Here is how to set up a Supabase environment from scratch for use with this project.
- Go to https://supabase.com/ and create an account.
- Crea un nuevo proyecto.
- Copy the Project URL and anon/public API key, and place them in your .env file as NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY
Enable the following providers in the Authentication > Providers section:
- Github
Follow the documentation to enable the auth providers in Supabase social login guide
The database structure, relationships, RLS policies, functions and triggers can be created automatically by executing the following SQL script: setup.sql
- Creation of tables
(profiles, customer, orders, etc.). - Relationship with users
(auth.users). - RLS policies to protect data per user.
- Functions and triggers necessary for the correct operation of the system.
- Go to your Supabase project.
- In the side panel, select SQL Editor.
- Create a new query and paste the contents of
setup.sql. - Run the script.
Note: This will automatically configure the entire database without the need for additional manual steps for tables, policies or functions.
- In Authentication > Emails
- In the Confirm signup template, change
{{ .ConfirmationURL }}to{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email.
-
In Storage > Buckets, create a bucket named
pictures. -
Disable public access.
-
Set the type of files allowed with
image/jpg, image/pngand save. -
In Storage > Policies add a new policy to the
picturesbucket:- Click Get started quickly.
- Select template Give users access to only their own top level folder named as uid.
- Allows operation for SELECT, INSERT and DELETE.
-
Configure your
next.config.mjsfile to allow images coming from supabase:const nextConfig = { images: { remotePatterns: [ { protocol: "https", hostname: "YOUR_SUPABASE_HOSTNAME", }, ], }, };
This ensures each user can only manage their own images within the application.
Note: Adds information from the
orderstable to be displayed in the application.
If you want to add new features, fix bugs, or improve the project, follow these recommended steps to contribute in an organized way:
-
Create a new branch following the naming standard
Use prefixes according to the type of change you are going to make, for example:feature/for new features (feature/new-feature)fix/for bug fixes (fix/bug-fix)chore/for maintenance tasks or minor changes (chore/update-dependencies)
Example to create a new feature branch:
git checkout main git pull git checkout -b feature/your-feature-name
-
Make your changes and commit
Make the necessary code changes. Then, save your changes with clear and descriptive commit messages:git add . git commit -m "Feature: Brief description of the changes made"
-
Push your branch to the remote repository
Push your branch so it is available on GitHub:git push origin your-branch-name
-
Create a Pull Request (PR)
Go to the repository page on GitHub and click on "Compare & pull request" to open a new PR. Briefly describe the changes and why they are necessary. -
Review and merge
Wait for your PR to be reviewed. If everything is correct, it will be merged into the main branch.
Thank you for contributing! If you have questions, check the GitHub collaboration guide.
Thank you for checking out my project! If you have suggestions or find any issues, feel free to open an issue or a pull request.