MovieLandia Backend is a REST API and also acts as MVC with EJS Template engine, for managing movies and related entities such as series, genres, and episodes. Built using Fastify for a fast and efficient server, with EJS for server-side rendering.
- Fastify-based server for high performance
- EJS for server-side rendering
- Prisma ORM for database interactions
- JWT authentication
- Swagger for API documentation
-
Clone the repository:
git clone https://github.com/yourusername/movielandia-backend.git cd movielandia-backend
-
Install dependencies:
npm install
-
Set up the database:
Configure your
.env
file with your database connection details and other environment variables:DATABASE_URL="your_database_url" MY_SECRET="your_jwt_secret"
-
Apply Prisma migrations:
npx prisma migrate dev
-
Start the development server:
npm run dev
-
Open your browser:
Navigate to
http://localhost:4000
to see the application in action.
├── src
│ ├── routes
│ │ ├── auth.routes.ts
│ │ ├── episode.routes.ts
│ │ ├── genre.routes.ts
│ │ ├── movie.routes.ts
│ │ ├── serie.routes.ts
│ │ ├── user.routes.ts
│ │ └── views.routes.ts
│ ├── views
│ │ ├── layouts
│ │ │ └── MainLayout.ejs
│ │ └── other_views.ejs
│ ├── app.ts
│ └── plugins
│ └── auth.decorators.ts
├── public
│ ├── styles
│ │ ├── tailwind.css
│ │ └── style.css
│ └── other_public_files
├── prisma
│ ├── schema.prisma
│ └── migrations
├── .env
└── package.json
Ensure you set up the following environment variables in your .env
file:
DATABASE_URL
: Your database connection stringMY_SECRET
: Secret key for JWT
Swagger documentation is available at http://localhost:4000/api-docs
once the server is running.
npm run dev
: Starts the development server with nodemon.npm run start
: Starts the server without nodemon.npm run tailwind:css
: Compiles Tailwind CSS.npm run pretty
: Formats the code using Prettier.