Skip to content

This repository offers a streamlined approach to building multilingual REST APIs with NestJS, focusing on essential features without unnecessary complexity. Explore the power of i18next for internationalization and enjoy a clean structure that enhances your development experience. πŸŒπŸš€

Notifications You must be signed in to change notification settings

edgar12233/nestjs-api-i18n-auth-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NestJS API i18n Auth Starter πŸš€

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.

Releases

Table of Contents

Features

  • 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.

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (version 14 or later)
  • npm or yarn
  • A Google account for OAuth setup

Installation

  1. Clone the repository:

    git clone https://github.com/edgar12233/nestjs-api-i18n-auth-starter.git
  2. Navigate to the project directory:

    cd nestjs-api-i18n-auth-starter
  3. Install the dependencies:

    npm install

    or

    yarn install

Configuration

  1. 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
  2. Replace the placeholders with your actual Google OAuth credentials and a secret for JWT.

Usage

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.

API Endpoints

Authentication

  • POST /auth/login: Login with Google OAuth.
  • GET /auth/logout: Logout the current user.

Internationalization

  • GET /i18n/:lang: Get translations for the specified language.

Validation

  • POST /validate: Validate incoming data against defined schemas.

Testing

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.

Contributing

We welcome contributions! If you would like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature/YourFeature).
  6. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • 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.

Conclusion

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!

About

This repository offers a streamlined approach to building multilingual REST APIs with NestJS, focusing on essential features without unnecessary complexity. Explore the power of i18next for internationalization and enjoy a clean structure that enhances your development experience. πŸŒπŸš€

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •