AdminVUE

VueJs Admin Template with .NET Core 6


Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, feel free to email me.

If you are looking for a Javascript framework based template for your upcoming project then probably you come to the right place.
 
AdminVUE is a light Admin template, developed based on modern Vuejs framework with Vuefify(new UI framework),
.NET core 6, Entity Framework core 6.0.0 & Vuex state management. The most amazing part of this template is, you have five popular Relational database connectivity options here.You have flexibility to choose Sql server, Mysql, Sqlite, PostgreSql and Oracle 12c+.
 
AdminVUE template consists of two separate project, one is AdminAPi for API and the other is AdminClient project for UI.
 
Both of the projects are developed separately and you have full flexibility to use them independently.

 

AdminVUE template has two separate project i.e. AdminClient and AdminApi.

                        -> dotnet ef migrations add initial
                        -> dotnet ef database update
                        -> dotnet run
                You should see your API listening at localhost:5001.

                        -> npm install
                        -> npm run serve

                Your project will be running at localhost:8080. 

 

N.B: This is just a quick start note, you need to follow full documentation for full project set up which starts from below.

 

"ConnectionStrings": {

    "ApiConnStringMssql": "data source=Sangib-PC;initial catalog=admindb;
     persist security info=True;Integrated Security=SSPI;",

    "ApiConnStringMysql": "server=localhost;port=3306;database=admindb;user=root;",

    "ApiConnStringOracle": "Data Source=(DESCRIPTION=(ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))  
    (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orclpdb)));User Id=root;Password=root;",

    "ApiConnStringSqlite": "Data Source=admindb.db;",

    "ApiConnStringPostgreSql": "Server=127.0.0.1;Port=5432;Database=admindb;
    User Id=postgres;Password=postgres;"

  }

 

public void ConfigureServices(IServiceCollection services)

        {
            //Sql Server Connection String
            /* services.AddDbContextPool<AppDbContext>(opt => opt.UseSqlServer
            (Configuration.GetConnectionString("ApiConnStringMssql"))); */


            //Mysql Connection String
            services.AddDbContextPool<AppDbContext>(opt=>opt.UseMySql
            (Configuration.GetConnectionString("ApiConnStringMysql")));

            //Sqlite Connection String
            /* services.AddDbContextPool<AppDbContext>(opt=>opt.UseSqlite
            (Configuration.GetConnectionString("ApiConnStringSqlite"))); */


            //PostgreSql Connection String
            /* services.AddDbContextPool<AppDbContext>(opt=>opt.UseNpgsql
            (Configuration.GetConnectionString("ApiConnStringPostgreSql"))); */


            //Oracle Connection String
            /* services.AddDbContextPool<AppDbContext>(opt=>opt.UseOracle
            (Configuration.GetConnectionString("ApiConnStringOracle"))); */ 

 

               ->dotnet tool install --global dotnet-ef

               ->dotnet ef migrations add MigrationName

               ->dotnet ef database update

Assuming that you run both api and client projects by following previous steps. Now you just need to open config.js (/adminclient/src/config.js) from Client project and set hostname as http://localhost:5001 because our api is running here and you need to link with api from client.

export default{
    hostname:'http://localhost:5001'
}

 

For Windows Server with IIS

 

For Linux Server with Nginx

Here is some resourses so that you can find more detail about above installations-

 

Windows Server

  services.AddCors(options=>
   {
     options.AddPolicy(name:AllowSpecificOrigins,builder=>
       {
         builder.WithOrigins("http://localhost:8080","https://adminvue.com")
         .AllowAnyHeader()
         .AllowAnyMethod();
       });
   });

 now on vscode terminal write below command

                 -> dotnet publish

you will get a publish(/adminapi/bin/Debug/net6.0/publish) directory. Copy this publish directory to a physical path on server. Now open a new site on IIS with Site name, Physical path, IP address, Port and Host name. Now assuming that you set the Host name as api.adminvue.com, copy that name and store somewhere because we need that name just a bit later.

export default{
    hostname:'https://api.adminvue.com'
}

 now on vscode terminal write below command

                  ->npm run build

 you will get a dist(/adminclient/dist) directory. Now find a web.config (/adminclient/web.config) file on root directory of client project, Copy that file and paste it to inside dist directory. Everything is ready.

Now you need to copy this dist directory to a physical path on server and open another site with Host name as adminvue.com. That's all for windows server.

 

Linux(Ubuntu) Server

  services.AddCors(options=>
   {
     options.AddPolicy(name:AllowSpecificOrigins,builder=>
       {
         builder.WithOrigins("http://localhost:8080","https://adminvue.com")
         .AllowAnyHeader()
         .AllowAnyMethod();
       });
   });

 now on vscode terminal write below command

                 -> dotnet publish

you will get a publish(/adminapi/bin/Debug/net6.0/publish) directory. Now you will need to create a directory named AdminVue.Api on your Linux server. Execute below command on your linux terminal to create that directory then copy the publish directory to this (/var/www/AdminVue.Api) path.

                 -> sudo mkdir /var/www/AdminVue.Api

Now it's time to configure nginx, open a config file,

                -> sudo nano /etc/nginx/sites-enabled/adminvueApi

Place the below contents and save that file.

server {

    listen        80;
    server_name  api.adminvue.com;
    location / {
        proxy_pass         http://localhost:5001;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
  }
}
 
Let's create a service now to run your Api,
 
               -> sudo nano /etc/systemd/system/AdminVue.Api.service
 
Place below contents and save that service
 
          [Unit]
          Description=Api for AdminVue client App

          [Service]
          WorkingDirectory=/var/www/AdminVue.Api/publish
          ExecStart=/usr/bin/dotnet /var/www/AdminVue.Api/publish/AdminApi.dll
          Restart=always
          # Restart service after 10 seconds if the dotnet service crashes:
          RestartSec=10
          KillSignal=SIGINT
          SyslogIdentifier=AdminVue.Api
          User=ubuntu-user
          Environment=ASPNETCORE_ENVIRONMENT=Production
          Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
          Environment=ASPNETCORE_URLS=http://localhost:5001

          [Install]
          WantedBy=multi-user.target
 
 
Notice, the User is set to 'ubuntu-user' , Chnaged that by your linux user which has full permission on the app directory.
 
  • Now, Open Client project on VS Code and set that 'https://api.adminvue.com' on hostname to config.js file.

export default{
    hostname:'https://api.adminvue.com'
}

 now on vscode terminal write below command

                  ->npm run build

 you will get a dist(/adminvueclient/dist) directory. 

Now you will need to create a directory named AdminVue.Client on your Linux server. Execute below command on your linux terminal to create that directory then copy the dist directory to this (/var/www/AdminVue.Client) path.

                 -> sudo mkdir /var/www/AdminVue.Client

Next, open a config file,

                -> sudo nano /etc/nginx/sites-enabled/adminvueClient

Place the below contents and save that file.

server {
    listen      80;
    server_name adminvue.com;
    charset utf-8;
    root    /var/www/AdminVue.Client/dist;
    index   index.html;
    #Always serve index.html for any request
    location / {
        root /var/www/AdminVue.Client/dist;
        try_files $uri  /index.html;
    }
    error_log  /var/log/nginx/vue-app-error.log;
    access_log /var/log/nginx/vue-app-access.log;
}
 
 
Now let's end by executing below commands on linux terminal
              -> sudo systemctl enable AdminVue.Api
              -> sudo service mysql restart
              -> sudo service nginx restart 
 
That's all for linux server.

You can check the Swagger API documentation UI by navigating https://api.adminvue.com .First go to the /api/Users/GetLoginInfo/{username}/{password} method from documentation page then enter username and password, a token will be generated here. Use this token to authorize the api by clicking the Authorize button at the top right like "Bearer token". Then you will able to check all the methods as expected.

For Admin access, Username:admin@vueadmin.com Password:admin@2021

For User access, Username:user@vueadmin.com Password:user@2021

Once again, thank you so much for purchasing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script. I'll do my best to assist. If you have a more general question relating to this script you may also comment directly on product comment section.

Sangib Kumar Saha