Welcome to the NestJS API i18n Auth Starter! This project serves as a solid foundation for building multilingual REST APIs using NestJS. It features seamless integration with i18next for internationalization, robust validation mechanisms, and Google OAuth for secure authentication.
- Multilingual Support: Built-in support for multiple languages using i18next.
- Google OAuth: Easy integration with Google for user authentication.
- Validation: Strong validation capabilities to ensure data integrity.
- RESTful API: Follows REST principles for clear and efficient API design.
- Modular Architecture: Organized code structure for easy maintenance and scalability.
Before you begin, ensure you have the following installed:
- Node.js (version 14 or later)
- npm or yarn
- A Google account for OAuth setup
-
Clone the repository:
git clone https://github.com/edgar12233/nestjs-api-i18n-auth-starter.git
-
Navigate to the project directory:
cd nestjs-api-i18n-auth-starter
-
Install the dependencies:
npm install
or
yarn install
-
Create a
.env
file in the root directory and add your environment variables. Here's a sample configuration:GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret JWT_SECRET=your-jwt-secret
-
Replace the placeholders with your actual Google OAuth credentials and a secret for JWT.
To start the application, run:
npm run start:dev
or
yarn start:dev
The application will run on http://localhost:3000
. You can modify the port in the configuration if needed.
- POST /auth/login: Login with Google OAuth.
- GET /auth/logout: Logout the current user.
- GET /i18n/:lang: Get translations for the specified language.
- POST /validate: Validate incoming data against defined schemas.
To run tests, use:
npm run test
or
yarn test
This will execute the test suite and provide you with a report of the results.
We welcome contributions! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Thanks to the NestJS community for their amazing framework.
- Special thanks to the i18next team for their excellent internationalization library.
- A big shoutout to Google for providing OAuth services that enhance our application's security.
For more details, check the Releases section for updates and new features.
The NestJS API i18n Auth Starter project provides a comprehensive starting point for developers looking to build multilingual REST APIs. With its robust features and clear structure, you can focus on developing your application without worrying about the foundational setup.
Explore the code, make improvements, and build something great!