Ozodbek Alimjonov
Ozodbek
Let's Talk
Back to Projects

create-oziy-backend ( NPM Package )

NPM Package, Web Development

create-oziy-backend ( NPM Package )

create-oziy-backend is a CLI tool that generates a production-ready Express.js backend with authentication, validation, security middleware, and database integrations. The goal of this project is to eliminate repetitive backend setup and allow developers to start building APIs immediately. Installation npx create-oziy-backend my-project or npm install -g create-oziy-backend create-oziy-backend Authentication Example Below is a simplified version of the user registration logic used in the generated backend. async register({ name, email, password }) { const hashed = await hashPassword(password); const user = { id: crypto.randomUUID(), name, email, password: hashed, role: 'user', isEmailVerified: false, }; users.push(user); return user; } This function: hashes the user password using bcrypt generates a unique user ID creates a user object stores the user securely Email Verification with OTP The backend also supports OTP verification. async verifyEmail(email, otp) { const stored = otpStore.get(email); if (!stored || Date.now() > stored.expiresAt) throw createError('OTP expired', 400); if (stored.otp !== otp) throw createError('Invalid OTP', 400); const user = users.find((u) => u.email === email); user.isEmailVerified = true; otpStore.delete(email); return user; } This ensures users must verify their email before accessing the system. Login Example Login verifies both password and email verification status. async login(email, password) { const user = users.find((u) => u.email === email); if (!user) throw createError('Invalid email or password', 401); const isMatch = await comparePassword(password, user.password); if (!isMatch) throw createError('Invalid email or password', 401); if (!user.isEmailVerified) throw createError('Please verify your email', 403); return user; } Password Reset Flow Users can request a password reset token. async forgotPassword(email) { const user = users.find((u) => u.email === email); if (!user) return; const resetToken = crypto.randomBytes(32).toString('hex'); resetTokenStore.set(resetToken, { userId: user.id, expiresAt: Date.now() + env.OTP_EXPIRES_IN }); } Security The generated backend includes: JWT Authentication bcrypt password hashing rate limiting request validation secure headers refresh token system Links GitHub https://github.com/Ozodbekk1/oziy-starter-backend NPM https://www.npmjs.com/package/create-oziy-backend

View Live