A dynamic and intuitive application for managing a library's collection of books, allowing users to add, update, delete, and search for books.
- Book Management: Easily add, update, delete, and search for books in the library's collection.
- Pagination: View books with pagination for better browsing.
- Validation: Ensures required fields are filled when adding or editing books.
- Search Functionality: Search for books by title, author, genre, or year.
- Error Handling: User-friendly error messages for invalid input or server issues.
- Database: SQLite, Sequelize ORM
- Templating: Pug
- Frontend: HTML, CSS, JavaScript
- Server: Express.js
- Version Control: Git
- Package Manager: npm
sql-library-manager/
├── bin/
│ └── www # HTTP server setup
├── dist/ # Compiled output files
│ └── ...
├── migrations/
│ └── <timestamp>-create-book.ts # Database migration file for books table
├── node_modules/ # Project dependencies
├── public/
│ └── stylesheets/
│ └── style.css # Styles for the application
├── src/
│ ├── config/
│ │ └── config.example.ts # Example config for setup
│ ├── models/
│ │ ├── book.ts # Book model definition
│ │ └── index.ts # Sequelize model and instance setup
│ ├── routes/
│ │ ├── index.ts # Routes for book management
│ │ └── users.ts # Routes for user management
│ └── app.ts # Main app entry point
├── views/
│ ├── index.pug # Main page displaying list of books
│ ├── new-book.pug # Form to add a new book
│ ├── form-error.pug # Error page for form validation
│ ├── layout.pug # Layout template for the app
│ └── ... # Other Pug templates
├── your-database-name.db # SQLite database file
├── package.json # NPM dependencies and scripts
├── tsconfig.json # TypeScript configuration file
├── .gitignore
└── README.md
-
Clone the repository:
git clone https://github.com/dmcote1991/sql-library-manager.git
-
Navigate to the project directory:
cd sql-library-manager
-
Install dependencies:
npm install
-
Set up the configuration file: Copy the example configuration file and adjust settings as needed.
cp config/config.example.json config/config.json
-
Set up the database: Run the migrations to set up the SQLite database and create the necessary tables.
npx sequelize-cli db:migrate
-
Start the server:
npm start
The application will run on
http://localhost:3000
.
-
View all books:
Navigate to the root URL (http://localhost:3000
) to view the list of books. -
Add a new book:
Click the "Add New Book" button, fill in the book details, and submit the form. -
Edit or delete a book:
Each book entry has options to update or delete the book. -
Search for books:
Use the search form at the top to find books by title, author, genre, or year.
-
Database Configuration: Modify the
config/config.json
file to specify your database settings. -
Project Showcase: This project is designed as a demonstration of CRUD functionality and database management. For production usage, additional security and optimization would be recommended.